Page 1 of 1

FormBuilder Help Needed Input Fields

Posted: Fri Jul 06, 2007 9:33 pm
by gallowstree_merlin
I am attempting to use a form in FormBuilder as input to populate a MYSQL database table.  I have been able to then use FormBrowser to populate the FormBrowser's table in the database.  I do not want to use this method as this puts the data into the table in a way that needs a lot of manipulation to format it for the output I want.  A flat structure table would best suit my needs.

I really want to pass the input variables to a User Defined Tag so that I can use a SQL query to INSERT them into the database table.  However I do not have sufficient (hardly any) php or Smarty knowledge to properly access the fields.  Have spent hours attempting this.  Once I can properly access the fields and their values I can write the query to insert the field values into the database.

Need clear guidlines on how to pass the fields input to the UDT either when calling it or how to access them from the UDT.

My input fields from the FormBuilder submission template are:

$date} / {$fld_66} date
{$town} / {$fld_67} town
{$venue} / {$fld_68} venue
{$address} / {$fld_69} address
{$venue_phone} / {$fld_70} venue_phone

Any help would be great

Alan

Re: FormBuilder Help Needed Input Fields

Posted: Mon Mar 16, 2009 10:37 am
by musicscore
I used CTLModuleMaker (if you used this module you love it) and created the following udt to write data from an Formbuilder-form to the database (mysql) :

global $smarty;
$tpl_vars = $smarty->get_template_vars();

global $gCms;
$db = &$gCms->GetDb();

$naam = $tpl_vars['naam'];
$email = $tpl_vars['email'];
$...... = $tpl_vars .......


$query = "INSERT INTO (database_table_naam) (name, email, .....) VALUES ('$naam', '$email', '$......')";
$db->Execute($query);

ATTENTION: You have to add a field in the form to use the udt AND the send the form to an e-mail or file.

The combination CTLModuleMaker and Formbuilding really Rocks
Thanx to people who build the modules.

Musicscore