Forums

save 3 records from a single form

it@iuslaboris.com 08 Dec, 2011
hello,

I have chronoform v3

Could you drive me in the right direction?
I have a form with jquery tabs, I would like to save 3 records at the same time.
I have different form fields for the 3 records.
Actually on submit, 1 record is saved with fields corresponding with the table.

I guest that i have to use "On Submit code - after sending email:"

somebody could give me a sample code?

Thanks
GreyHead 08 Dec, 2011
Hi [email]it@iuslaboris.com[/email],

ChronoForms v3 only supposts saving a single record automatically. You can add the necessary code in the OnSubmit After Email box to do the three separate saves. The code in the AutoGenerated box will show you how ChronoForms does it; you can either copy this or write your own code.

Bob
it@iuslaboris.com 08 Dec, 2011
thanks Bob,

I just found a home made solution before you gave me a solution:

<?php
$db =& JFactory::getDBO();

$db->setQuery("INSERT INTO `jos_chronoforms_congress01` (`cf_id`, `name`, `firm`, `email`) VALUES (NULL, '". $_POST[name1]."','". $_POST[firm1]."','". $_POST[email1]."'
);
");
if (!$db->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); </script>
";
}
?>


This code is very simple, what are the advantage of using your code? Just to know if It is better ?
This topic is locked and no more replies can be posted.