I created a form for booking.
Now I'd like to send the email as an invoice. Therefor I need to create an invoicenumber. Creating should be easy by using the last cf_id of the forms table.
Getting this value in Standard "Form-hmtl" is not a Problem:
But I want to do this just "on Submitting form", because when questioning this before, two users could get the same Number.
I tried to use it "on submit - befor sending email", but didn't get the value {last_id} displayed in the email.
Any solutions? Or is there an other way of getting autocrementing number from the database?
Now I'd like to send the email as an invoice. Therefor I need to create an invoicenumber. Creating should be easy by using the last cf_id of the forms table.
Getting this value in Standard "Form-hmtl" is not a Problem:
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Last ID:*</label>
<input class="cf_inputbox required" maxlength="50" size="40" title="" id="text_12" name="name" type="text" value="<?php $db =& JFactory::getDBO();
$SQL = 'SELECT MAX(cf_id) AS mid FROM jos_chronoforms_buchung3';
$res = mysql_query($SQL);
$ret = mysql_fetch_array($res);
$wert = $ret['mid'];
echo $wert;
$wert = $wert+1;
echo $wert;
?> " />
</div>
<div class="cfclear"> </div>
</div>
But I want to do this just "on Submitting form", because when questioning this before, two users could get the same Number.
I tried to use it "on submit - befor sending email", but didn't get the value {last_id} displayed in the email.
Any solutions? Or is there an other way of getting autocrementing number from the database?