insert FormBuilder fields into database

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
boby
Forum Members
Forum Members
Posts: 94
Joined: Thu Feb 21, 2008 11:31 pm

insert FormBuilder fields into database

Post 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);


musicscore
Power Poster
Power Poster
Posts: 496
Joined: Wed Jan 25, 2006 11:53 am

Re: insert FormBuilder fields into database

Post 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
boby
Forum Members
Forum Members
Posts: 94
Joined: Thu Feb 21, 2008 11:31 pm

Re: insert FormBuilder fields into database

Post 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.
boby
Forum Members
Forum Members
Posts: 94
Joined: Thu Feb 21, 2008 11:31 pm

Re: insert FormBuilder fields into database

Post by boby »

Actually i got an answer in the French forum:
Have a look here: http://www.cmsmadesimple.fr/forum/viewtopic.php?id=1375
Post Reply

Return to “Developers Discussion”