Hi,
Try deriving realname and email fields on the last page.
http://www.tectite.com/fmhowto/derived.php
ginger
Welcome to the Tectite Forums! You can download and get support for our free PHP FormMail (form processor) and other free software.
I am building a multi-page form and everything seems to be working well except for one thing. The email field value will not show up in my 'thank you' page template. It works in the email template and it works with a single-page form. The realname field was also not working but I changed it to $firstname $lastname and that fixed that problem. (However, I am deriving a realname field on the first page so I don't understand why that wasn't working.)
I have the email field in the 'multi_keep' field but it is just blank in my template. It is in the template as $email.
Thanks.
Steve
Hi,
Try deriving realname and email fields on the last page.
http://www.tectite.com/fmhowto/derived.php
ginger
The realname field is a derived field but email is not. However, I set the realname field to derive on the last page of my form and it is still not showing up. Only $firstname and $lastname work.
Here's the strange part.
$realname and $email DO NOT SHOW UP in my 'Thank You' page or the plain text e-mail I receive from my server.
THEY DO SHOW UP in the HTML e-mail (my template) I receive from the Formmail script. The code in my e-mail template and 'Thank You' page template look exactly the same.
Also on the plain text e-mail, the following field values are shown: firstname, lastname, email2 (email2 is the field where the user confirms the email address they entered into the email field on Page 1)
You can see the form at http://www.alfatransformer.com/test/..._test_page.php
Any further help would be greatly appreciated. Thank you.
Last edited by stevelockridge; 14-Aug-2008 at 03:29 PM. Reason: Add URL
Just so I'm understanding what you've done, let me make sure this is what you have:
So, on your first page you have 2 input fields for firstname and lastname? And where you have someone enter their email address you have it named something other than "email" like maybe "emailaddress", correct? Then on the last page you have the following:
Then, in your templates, you have:Code:<input type="hidden" name="derive_fields" value="email=emailaddress, realname=firstname + lastname" />
Name: $firstname $lastname
Email: $emailaddress
Is this how you've done it?
ginger
Ginger -
On the first page I have the following:
HIDDEN FIELDS - FIRST PAGE
<form method="post" action="http://www.alfatransformer.com/test/alfaforms.php" name="Formmail Test Page" enctype="x-www-form-urlencoded">
<input type="hidden" name="this_form" value="http://www.alfatransformer.com/test/formmail_test_page.php" />
<input type="hidden" name="multi_start" value="1" />
<input type="hidden" name="next_form" value="formmail_test_page_2.php" />
<input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
<input type="hidden" name="recipients" value="slockridge_AT_alfatransformer.com" />
<input type="hidden" name="required" value="email:Your email address,firstname:Your first name,lastname:Your last name,email=email2" />
<input type="hidden" name="derive_fields" value="realname = firstname + lastname" />
<input type="hidden" name="multi_keep" value="realname,firstname,lastname,email" />
<input type="hidden" name="subject" value="PHP Formmail Test Page" />
<input type="hidden" name="mail_options" value="HTMLTemplate=email_template.html,TemplateMissing=N/A" />
<input type="hidden" name="bad_url" value="http://www.alfatransformer.com/test/fmbadhandler.php" />
<input type="hidden" name="bad_template" value="bad_test_template.html" />
FORM FIELDS - FIRST PAGE
<input name="firstname" type="text" id="firstname" size="40" />
<input name="lastname" type="text" id="lastname" size="40" />
<input name="email" type="text" size="40" />
<input name="email2" type="text" size="40" />
<input type="submit" name="submit" value="Next >" />
VARIABLES - EMAIL TEMPLATE (this works)
Name: $realname
E-Mail: $email
VARIABLES - THANK YOU PAGE TEMPLATE (this does not work)
Name: $realname
E-Mail: $email
Thank you for your help.
Ok, try doing it as I suggested, using different names on the form for the special fields that make up realname and email (firstname + lastname is ok for the realname field, but rename the email field to something like email1). For the multi_keep field, place firstname, lastname and email1. You'll also want to change "email" to "email1" in your required fields tag.
Then on the last page use the derive fields tag to put the values of firstname + lastname, and email1 into the special fields of realname and email. And in your templates use the derived field names like $firstname + $lastname, and $email1 for the email address.
... basically what I described in my previous post.
I have to leave in a few minutes, so let me know how that works out for you.
ginger
Ginger -
I'm not sure I understood completely but I did make some changes and it's working. Here's what I changed:
FIRST PAGE
<input type="hidden" name="derive_fields" value="realname = firstname + lastname,email = email1" />
<input type="hidden" name="required" value="email1:Your email address,firstname:Your first name,lastname:Your last name,email1=email2" />
<input type="hidden" name="multi_keep" value="firstname,lastname,email1" />
<input name="email1" type="text" size="40" />
<input name="email2" type="text" size="40" />
LAST PAGE
<input type="hidden" name="derive_fields" value="realname = firstname + lastname, email = email1" />
TEMPLATE
Name: $firstname $lastname
E-Mail: $email1
The first page instructions I understood. The last page and template instructions I wasn't sure about. I don't understand why realname = firstname + lastname but it won't display in the Thank You template, but will display in the E-Mail template. Also, the same with email. The value email1 works but not email. If you don't mind explaining why I would appreciate it. I plan to delve a whole lot deeper into this script and I would like to understand how each part works.
Thank you.
Glad to hear it's working. You don't need to derive the fields twice; just do it on the last page instead of on the first AND last.
I can't explain WHY, but "realname" and "email" are special fields that are handled differently by the script, especially in situations where you're going back and forth between pages.
You'll find the same problem if you try to return to the form from an error template; the values for the fields realname and email won't be filled in when returning to the form to make corrections. I think this is documented in a thread in this forum about deriving field names for those 2 special fields when using fmbadhandler and an error template.
That's the best I can do to explain why, but the important thing is that it works.
ginger
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks