But
<?php $db =& JFactory::getDBO(); $_POST['new_id'] = $db->insertid(); ?>
doesn't work. One workaround I have found is:
<?php
$sql = "SELECT MAX(cf_id) + 1 AS id FROM jos_chronoforms_mytable";
$db->setQuery($sql);
$result = $db->loadObject();
$_POST['new_id'] = $result->id;
?>
and then of course referencing {new_id} in the email template.
This hack works as long as the insert is successful, but pretty weak IMHO. The fact that this works suggests that this code in the "On Submit before sending email" section is executed before the email is sent, AND before the data is saved. Is there any hook that's between saving and sending?
Is there any other more reliable way to send the insert_id ( insertid() ) of the submitted data's row in the email?
I have looked through the forums for a couple hours, but if I overlooked something, a link would be greatly appreciated.🙂