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?"> show last cf_id in email with "On Submit code -before email" - Forums

Forums

show last cf_id in email with "On Submit code -before email"

office-4-sale 17 Aug, 2011
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:
<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?
GreyHead 17 Aug, 2011
Hi office-4-sale,

This has been discussed here several times. Searching the forums on cf_id should find you some code examples.

Bob
office-4-sale 17 Aug, 2011
Thanks for your fast reply. But searching the forum for "cf_id" results in: "The following words in your search query were ignored because they are too common words: cf id."

Well, i searched before and didn't find it, but now, together with google I got it ;-)
Posting http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=16978 did it.

I only needed to put
<?php echo "Number: ".$MyForm->tablerow["jos_chronoforms_Reserveren"]->cf_id;?>
into the email template. Remember to turn "off" Editor in email settings.

Thanks for this great compononent!
GreyHead 17 Aug, 2011
Hi office-4-sale,

Try the 'ChronoSearch' from the Tutorials menu above. That's a custom Google search for here, the Joomla! site and my site.

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