Forums

Help with CB plugin and INSERT into different table

stinko 13 Mar, 2009
Hi all,

ChronoForm is fantastic I'm think to buy it for my new site, but I have a little problem with the registration form using the CB plugin.

I've created a form with the wizard using the tutorial. The form has about 20 fields.
I've activated the CB plugin and filled the information in the CB field.

The information are saved into the jos_user for the user name and other thing.
I need to save some field in a particular table of my DB.
I've tried to insert the PHP code in the onsubmit before windows inside the cb plugin, but nothing happend.
I don't receive any error, but whe I look inside the table there isn't any information that I have entered.
I've tried to insert just a "echo" to see if the code is called but nothing happends.

The code that I need is like:

<?php
$host = "localhost";
$nome = "root";
$password = "root";
$db = "joomla";

$connessione=mysql_connect($host,$nome,$password); //connessione database

$name=mysql_real_escape_string($_POST['text_4']);
$surname=mysql_real_escape_string($_POST['text_5']);
$birthdate=mysql_real_escape_string($_POST['date_6']);
$chiplist=mysql_real_escape_string($_POST['text_7']);
$birthcity=mysql_real_escape_string($_POST['text_8']);
$gender=mysql_real_escape_string($_POST['select_9']);
$address=mysql_real_escape_string($_POST['text_10']);
$city=mysql_real_escape_string($_POST['text_11']);
$cap=mysql_real_escape_string($_POST['text_12']);
$province=mysql_real_escape_string($_POST['select_14']);
$region=mysql_real_escape_string($_POST['select_15']);
$country=mysql_real_escape_string($_POST['select_16']);
$email=mysql_real_escape_string($_POST['text_17']);
$phone=mysql_real_escape_string($_POST['text_18']);
$mobile=mysql_real_escape_string($_POST['text_19']);
$codicefiscale=mysql_real_escape_string($_POST['text_20']);
$team=mysql_real_escape_string($_POST['select_21']);
$occupation=mysql_real_escape_string($_POST['select_22']);
$skill=mysql_real_escape_string($_POST['select_23']);
$newsletter=mysql_real_escape_string($_POST['newsletter_check']);
$inforead=mysql_real_escape_string($_POST['inf_read']);
$infoaccept=mysql_real_escape_string($_POST['inf_accept']);
$user=mysql_real_escape_string($_POST['text_29']);
$psw=mysql_real_escape_string($_POST['text_30']);

$query_inserimento=mysql_db_query($db,"INSERT INTO jos_chronoforms_reg_storage (text_4, text_5, date_6, text_7, text_8, select_9, text_10, text_11, text_12, select_14, select_15, select_16, text_17, text_18, text_19, text_20, select_21, select_22, select_23, newsletter_check, inf_read, inf_accept, text_29, text_30) VALUES('$name', '$surname', '$birthdate', '$chiplist', '$birthcity', '$gender', '$address', '$city', '$cap', '$province', '$region', '$country', '$email', '$phone', '$mobile', '$codicefiscale', '$team', '$occupation', '$skill', '$newsletter', '$inforead', '$infoaccept', '$user', '$psw')",$connessione);

?>


Someone can help me?

Thanks
Ale
Max_admin 13 Mar, 2009
Hi Ale,

I see your form fields and the posted variables have almost the same names so why you just don't use the DB connection in Chronoforms to let you do this in no time ? I suggest also that if you are going to do any DB actions that you use the joomla code space!

Cheers
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
stinko 14 Mar, 2009
I can't use the chronoform db connection because I need to save these information into two different table.

What are you meaning for joomla code space? How can I insert code in the joomla component login for example?
Max_admin 14 Mar, 2009

I can't use the chronoform db connection because I need to save these information into two different table.



if the fields names in 10 tables are the same as the posted variables names then you can save to 10 tables! if some field name is different then you can set a posted variable with this name!

by code space I mean to use the Joomla built in API to do the database actions, just search the forums for any SQL words and you will see how its done or open any joomla/extension file to see this

Regards
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.