Page 1 of 1

insert FormBuilder fields into database

Posted: Fri Feb 20, 2009 11:15 pm
by boby
I am using cmsms 1.5.2 with Form Builder 0.5.11.
I am calling a tag with the form results that connects to the DB and inserts the form fields into it.
I am filling the DB with fields name but I would like to insert the value of the fields.
I am looking for the right format.
Any help is welcome, thanks!!!

The tag is(I have been trying various formats):

Code: Select all

include "config.php";

if(!($db = @mysql_connect($config['db_hostname'],$config['db_username'],$config['db_password']))) //connect to database
die("couldn't connect to the database.");

if(!@mysql_select_db($config['db_name'],$db)) // Select Database
die("database doesn't exist!");

$sql = "INSERT INTO work (
        wc_id,
        wc_codigo,
	wc_nombre,
        wc_pais,
	wc_ado,
	wc_lugar,
	wc_hospedaje,
	wc_transporte,
	wc_start,
	wc_end,
	wc_proyecto,
	wc_trabajo,
	wc_tipo,	
	wc_costo,
	wc_moneda
)
        VALUES (
        '',
        '$_POST[$wc_codigo]',
	'$_POST[wc_nombre]',
        '{$wc_pais}',
	'{wc_ado}',
	'{wc_lugar}',
	'{wc_hospedaje}',
	'{wc_transporte}',
	'{wc_start}',
	'{wc_end}',
	'{wc_proyecto}',
	'{wc_trabajo}',
	'{wc_tipo}',	
	'{wc_costo}',
	'{wc_moneda}'
)";


$res = mysql_query($sql);



Re: insert FormBuilder fields into database

Posted: Mon Mar 09, 2009 8:00 pm
by musicscore
Boby,

I'm looking for the answer to a simalary problem.
I want to put the output of a form created with formbuilder to a database of a module created with CTLModuleMaker.
I'm not a programmer so a really need some help here.


Did you get an answer to your question ? And yes, what is the udt code you used ?    ???

Musicscore

Re: insert FormBuilder fields into database

Posted: Mon Mar 09, 2009 8:32 pm
by boby
I left formbuilder for now because smarty is giving me headache. I'll try to understand it later when I'll have more time.

I made an html form that call a php file. The php file do the connection, convert into utf8 and send the sql query to an external database.

If your form is not too complex it is easy to setup.
Let me know if this way is fine to you and if you need more details.
I don't too much about security details.

Re: insert FormBuilder fields into database

Posted: Mon Mar 09, 2009 8:37 pm
by boby
Actually i got an answer in the French forum:
Have a look here: http://www.cmsmadesimple.fr/forum/viewtopic.php?id=1375