Me and some friends are currently working on a project for school. The result should be a webapplication and we decided to use Drupal. So far it's coming a long nicely but at the moment we are somewhat stuck.

We have followed tutorials on how to write modules that select data from tables in the database and shows them on pages/in blocks: works like a charm. This is no problem at all.

Now, we are wondering how to do it the other way around (in Drupal). For example: we'd like to make a customized questionary in Drupal which can be filled in by users who are logged in. Thus a simple form should be created (I suppose we can use the Drupal Forms API for this?) which can be filled in and the information entered must be stored into the database.

We have experience developing things like these using plain PHP & MySQL, but now we are looking for best practices, hints, tips, examples (?) on how to achieve this in Drupal.

Any information would be greatly appreciated :)

Comments

ugerhard’s picture

Maybe you don't have to write a module yourself, have a look at the Webform module: http://drupal.org/project/webform

Anonymous’s picture

Thanks for the quick response.

Webform is a module we didn't know about yet - looks great. We'll look into it :)

Anonymous’s picture

The webform module was definitely worth looking at - unfortunately it doesn't cover all the things that we want to implement.

A questionary was just an example. We have custom tables with data that we'd like to edit using the webapplication (thus our Drupal CMS). Writing modules isn't a problem, we just don't know exactly how to handle forms.

For example: we have written a module providing a form (with the Forms API) where we can enter data using textfields. When submitting the form, we would like the data entered to be stored in the database (a custom table). After storing the data, an appropriate message must be shown.

Pure PHP/MySQL-wise, this is as easy as pie. With Drupal, we are having a harder time: where/how can we define the form action? How can we pass data through POST/GET to another page?

Any information, examples, hints, tips, ... be free to share them :)

ugerhard’s picture

Anonymous’s picture

Exactly what I was looking for. Thanks a lot :)

drupal.naresh’s picture

Hi all,

I am a newbie to the Drupal. I need help on the forms...

I read the topic on forms. I understood the topic very much, but i didn't understand few things..

Pls let me know,

where to put the php code and how that should be called in the page.

I would even appreciate, if you people can provide a complete example, in pushing forms data in to custom tables. and displaying the data in the page from the tables.

thanks.

- Naresh

chocolatebazzar’s picture

I am also doing something similar for my class. Unfortunately, I am not allowed to use code. I have to use ready-built modules for everything. Any suggestions?