1 form, 2 tables

vsbr 20 Feb, 2009
Hello!
I have created a form that is connected to 2 tables and the data are saved in the database correctly.
The problem is that one of the fields of the second table is the id (primary-key, auto-increment) of the first table and I need get this value to save it in the second table. Then, I have created a HiddenField but I don’t know how to read the value…
Thanks!
GreyHead 20 Feb, 2009
Hi vsbr,

You can use the $db->insertid() method to get the id of the last record created, you need to run this after the first record is saved and before the second. If you are using the ChronoForms Autogenerated Code to make the first save the results are all stored in a global variable called $row_chronocontact_form_name I think.

Bob
This topic is locked and no more replies can be posted.