Hello everyone.
I want to get data from the database (email id, state). then i want to display it in the webform component ( as select type). i know how to use the Conditional e-mail recipients. But i am struck with how to get the database content and to display it. If anyone knows, please guide me.
Thanks in advance.

Comments

vinothg’s picture

to insert/update/delete data:
db_query("SQL QUERY");

to select and display in a table:
$rows = array();
$res = db_query("select name,age,sex from user where sex='%s'", 'Male'); # assume there is a table user with name, age, sex columns
while ($row = db_fetch_object($res)) {
$rows[] = array($row->name, $row->age, $row->sex);
}
$header = array('Name', 'Age', 'Sex');
echo theme('table', $header, $rows);

Hope this helps

rajarju’s picture

You can create a custom webform field,
It can be added as a module and its pretty simple if you have already made some modules
this might help!!
http://www.framlinggroup.com/content/adding-custom-fields-webform-using-...

gmahesha’s picture

Hi friend, thanks for your kind info.