Forums

Sequence in the form of email

riga75 08 Aug, 2009
it is possible that when the email comes from the form there is also a field with a serial number?
For example, if two users that come complete the form provided in the email comes in addition to their data, there is also the first N1 and N2 email came in second

Thank you very much

Stefano
GreyHead 09 Aug, 2009
Hi Stefano,

Yes you can. The problem is how to save the serial numbers to know which is the next one. It's easy to do this if you are saving the data to the database, you can set the email to run after the AutoGenerated code and use the cf_id from the database record.

Bob
riga75 09 Aug, 2009
Hello Bob, thanks for your reply.
I will save the data already in the database, help me to understand how should I do? I did not understand much ...

Thanks

Stefano
riga75 11 Aug, 2009
News????
GreyHead 12 Aug, 2009
Hi riga75,

After the Autogenerated Code has run and saved the info in the table the results are in the $MyForm->tablerow["form_name"] object so I think you can pick up the id from $MyForm->tablerow["form_name"]->cf_id

Bob
riga75 13 Aug, 2009

Hi riga75,

After the Autogenerated Code has run and saved the info in the table the results are in the $MyForm->tablerow["form_name"] object so I think you can pick up the id from $MyForm->tablerow["form_name"]->cf_id

Bob




Sorry the question Bob 😲 , but the code that I have put the past where you get to do it via email?
Thank you very much

Stefano
riga75 17 Aug, 2009
News????
Thanks

Stefano
GreyHead 17 Aug, 2009
Hi Stefano,

It needs to go into the email template to be included in the email.

Bob
riga75 17 Aug, 2009
Sorry Bob but I can not understand.
I am entered on the form - tempalte emails and I see my email (I take as a reference to that test is: basicDemo and I did so:
Hello Admin,

Some user has submitted a new message for you, the message is submitted:

(message)

cf_id ()

the user's name is: (name)

$ MyForm-> TableRow [ "jos_chronoforms_basicDemo"] -> cf_id

But the email that arrives does not write the wrong id .... where?
thanks
GreyHead 17 Aug, 2009
Hi Stefano,

The snippet you need to add is PHP and must go between <?php . . . ?> tags. To add PHP to the Email template you *must* turn off the HTML editor in the Email Setup.

Bob
riga75 17 Aug, 2009
Nothing to do, I have disabled the editor I wrote this:
<? php
$ MyForm-> TableRow [ "jos_chronoforms_basicDemo"] -> cf_id
>
but except when he saves this:
$ MyForm-> TableRow [ "jos_chronoforms_basicDemo"] -> cf_id
>
GreyHead 17 Aug, 2009
Hi Stefano,

Please will you find a simple PHP tutorial and check that your PHP is correct and will output a value.

I can't teach you basic PHP here.

Bob
riga75 17 Aug, 2009
Sorry Bob, but as the editor disability?
Thank you
I have JCE and I went into the general configuration, but if I turned in within chronoform the editor is always
riga75 17 Aug, 2009
I now arrive in the mail this way

Hello Admin,

Some user has submitted a new message for you, the message submitted is:

kjhgk

{cf_id}

the user's name is: stefano


seems not to know what must take the value

cf_id ()
riga75 25 Aug, 2009
I tried to do what you told me Bob but the email arrives with the code and as if they recognize the code that you gave me ... where am I wrong?
The code is this:
<p> Hello Admin, </ p>
<p> Some user has submitted a new message for you, submitted the message is: </ p>
<p> (message) </ p>
<p> the user's name is: (name) </ p>
<p> <br /> <br />

<? php
$MyForm->tablerow["jos_chronoforms_basicDemo"]->cf_id
?>

and the email I get is this:

Hello Admin,

Some user has submitted a new message for you, the message is submitted:

hkljhlkjc sfgdsf

the user's name is: stefan


Thanks
GreyHead 25 Aug, 2009
Hi riga75,

Try
<?php
echo $MyForm->tablerow["jos_chronoforms_basicDemo"]->cf_id;
?>

Bob
riga75 25 Aug, 2009
Hi Bob,

now the email that arrives is:

Parse error: syntax error, unexpected T_ECHO in / home / mydomain.com / public_html / components / com_chronocontact / libraries / mails.php (98): eval () 'd code on line 7

GreyHead 25 Aug, 2009
Hi riga75,

We gained an extra space in the copy and paste - should be <?php no spaces.

Bob
riga75 25 Aug, 2009

Hi riga75,

We gained an extra space in the copy and paste - should be <?php no spaces.

Bob



now the email arrives but this:

DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base Href="http://www.tregima.it//" />
<title> Email </ title>
</ Head>

<body> <p> Hello Admin, </ p>

<p> Some user has submitted a new message for you, submitted the message is: </ p>
<p> kjhgkjhgkjh </ p>
<p> the user's name is: line </ p>
<p> <br /> <br />
<br /> <br />
Submitted by 79.0.75.203 </ body>
</ Html>

GreyHead 04 Oct, 2009
Hi riga75,

I'm no longer sure what the question is. The last but one email you posted looked correct for the template code you've used.
[sendfb][/sendfb]
Bob
GreyHead 04 Oct, 2009
Hi riga75,

Well it took a while to work out but I think there are two changes you need.

First, on the DB Connection tab set "Saving Data/Emails order" to 'Before Email'

Second, you need to make the table name all lowercase in the Email template
<?php
echo $MyForm->tablerow["jos_chronoforms_basicdemo"]->cf_id;
?>
Not basicDemo

Bob
riga75 05 Oct, 2009
Nothing to do Bob, I made the changes that you told me but nothing has changed.
The email that arrives does not have the ID number of the table



STefano
GreyHead 05 Oct, 2009
Hi Stefano,

It's working OK here - just checked again. I'll send you a backup copy of my form.

Bob
marcielo 21 Oct, 2009
Hi there

I tried to reproduce the same but I also get no cf_id in the email.

1. The name of the form is with lower case
2. I disabled the html editor in the email 'setup emails' tab
3. I changed the setting in the 'DB connection' tab to 'before email'
4. I inserted the code in the 'emails templates' tab:
<?php
echo $MyForm->tablerow["jos_chronoforms_test"]->cf_id;
?>

But nothing happened after submitting the form😟

OK I solved it two minutes after posting... as you can see in the attachment the Email format is set to 'Plain text' change it to 'HTML' and now it works🙂
I hope this can become handy
GreyHead 21 Oct, 2009
Hi Marcielo,

Great, glad it's fixed I don't know why switching from Plain text to HTML should make the difference . . . but if it works that's good.

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