Retrieve primary key of record submitted to database.

natloz 10 Aug, 2016
I would like to be able to return the newly generated primary key of a database insert from a form so that I can perform a custom php update on another table using this key. How can I retrieve the newly inserted primary key during the submit event of a form?
GreyHead 10 Aug, 2016
Answer
Hi Natloz,

ChronoForms adds it to the form data usually as $form->data['id'] or $form->data['cf_id'] depending on the name in your table.

If you add a Debugger you will be able to see exactly what it is called in your form.

Bob
natloz 11 Aug, 2016
Works like a charm. Thanks for sharing your wisdom on the topic.
This topic is locked and no more replies can be posted.