[Solved] receive the value of cf_id

Shows some Tutorials

[Solved] receive the value of cf_id

Postby loli » Wed Jun 08, 2011 5:02 pm

Hi,
in my email I wanted to receive the value of cf_id, I put in Step3 Design your Email(s): Id {cf_id}
but in my inbox I receive Id {cf_id} instead of the value of {cf_id}

Thank you for your help
Last edited by loli on Fri Jun 10, 2011 2:46 am, edited 1 time in total.
loli
Fresh Boarder
 
Posts: 19
Joined: Fri Jun 03, 2011 2:14 pm

Re: receive the value of cf_id

Postby GreyHead » Wed Jun 08, 2011 7:06 pm

Hi loli,

This is the cf_id from the saved record? And you are using ChronoForms v3.2?

This isn't available until after the data has been saved to the database and then you have to get the value from the saved data record.

The code you need is here:
Code: Select all
<?php
$MyForm =& CFChronoForm::getInstance('my_form_name');
$cf_id = $MyForm->tablerow['jos_chronoforms_my_table_name']->cf_id;
echo $cf_id;
?>
It must go into the Email template - to do this you have to turn the Email Riche text editor off on the Email Properties box.

Then you must set the DB Connection to run Before Email.

Bob
Bob Janes : ChronoForms Support

Tell us how we are doing - the Chrono Satisfaction Survey

If you'd like to buy me a beer - then thank you very much :-)
User avatar
GreyHead
Administrator
Administrator
 
Posts: 31972
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re: receive the value of cf_id

Postby loli » Wed Jun 08, 2011 8:12 pm

This is the cf_id from the saved record?

yes
And you are using ChronoForms v3.2?

yes

in Setup Email I put Use Template Editor:NO, I then paste the code in Emails Templates,
test after I received my mail in the following error:
Code: Select all
Parse error: syntax error, unexpected '>' in /home/instantr/public_html/components/com_chronocontact/libraries/mails.php(98) : eval()'d code on line 5



Thank you
Last edited by loli on Wed Jun 08, 2011 9:51 pm, edited 1 time in total.
loli
Fresh Boarder
 
Posts: 19
Joined: Fri Jun 03, 2011 2:14 pm

Re: receive the value of cf_id

Postby GreyHead » Wed Jun 08, 2011 9:50 pm

Hi loli,

Did you replace my_form_name and my_table_name with the names of your form and your table?

Bob
Bob Janes : ChronoForms Support

Tell us how we are doing - the Chrono Satisfaction Survey

If you'd like to buy me a beer - then thank you very much :-)
User avatar
GreyHead
Administrator
Administrator
 
Posts: 31972
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re: receive the value of cf_id

Postby loli » Wed Jun 08, 2011 10:12 pm

Did you replace my_form_name and my_table_name with the names of your form and your table?

thank you very much it works
loli
Fresh Boarder
 
Posts: 19
Joined: Fri Jun 03, 2011 2:14 pm

Re: receive the value of cf_id

Postby joomir » Thu Jun 09, 2011 6:31 am

Hi,

thanks, i am using cf_id to show user ticket.
http://www.joomir.com وب هاستینگ
User avatar
joomir
Fresh Boarder
 
Posts: 5
Joined: Fri May 13, 2011 11:26 am
Location: تهران

Re: receive the value of cf_id

Postby joomir » Thu Jun 09, 2011 7:45 am

for getting cf_id i am using this code:


<?php

$db =& JFactory::getDBO();
$query = "SELECT * FROM Your_Table_Name order by cf_id DESC";
$db->setQuery($query);
$row = $db->loadRow();
echo($row[0]);
?>

in on submit code with custom action
http://www.joomir.com وب هاستینگ
User avatar
joomir
Fresh Boarder
 
Posts: 5
Joined: Fri May 13, 2011 11:26 am
Location: تهران

Re: receive the value of cf_id

Postby GreyHead » Thu Jun 09, 2011 9:19 am

Hi joomir,

That code is not entirely reliable. If two (or more) people are using the form at the same time then this may give you the incorrect value.

  1. User 1 creates new record id = 100
  2. User 2 creates new record id = 101
  3. User 1 gets last record id = 101
  4. User 2 gets last record id = 101

Bob
Bob Janes : ChronoForms Support

Tell us how we are doing - the Chrono Satisfaction Survey

If you'd like to buy me a beer - then thank you very much :-)
User avatar
GreyHead
Administrator
Administrator
 
Posts: 31972
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany


Return to ChronoForms How To

Who is online

Users browsing this forum: ben.pedroza and 6 guests

 

Who is online

In total there are 7 users online :: 1 registered, 0 hidden and 6 guests (based on users active over the past 15 minutes)
Most users ever online was 441 on Sat Jul 14, 2012 10:55 am

Users browsing this forum: ben.pedroza and 6 guests

Current time

It is currently Fri May 24, 2013 5:49 am