php variable in html email

janssen 03 Apr, 2014
Hi,

I'm busy with a form on a website with subscription.
The form is finished except one point.

I have made a variable with the title af the last page that is visited before the user fills in the form.
My problem is to send the variable in the email.
The data that is stored in the variable doesn't show up in the html email that is send to the admin.
I get at the moment empty {} in the email.

Is there a simple solution to send the data with a html email?

Thanks!
GreyHead 03 Apr, 2014
Hi Janssen,

What's the variable you have it stored in? it's probably out of scope when the Email is created. Please see this FAQ

Bob
janssen 03 Apr, 2014
$vacaturetitle = $_SERVER['HTTP_REFERER'];
$vacaturetitle = str_replace('http://www.....nl/','',$vacaturetitle);

I need the title from the previous page (page before the form) to send with email, because the admin knows from with page the form is filled in.
GreyHead 04 Apr, 2014
Hi janssen,

I think that the FAQ covers that?

Bob
janssen 05 Apr, 2014
Oke, thank you for the quick response.
I have tryed to add <input type='hidden' name='page_title' id='page_title' value='<?php echo $doc->getTitle(); ?>' />

and add to de variable the pagetitle of the page before de form in the template..
When i do this i get a plane form without my website styling.

## In template
$vacaturetitle = $_SERVER['HTTP_REFERER'];
$vacaturetitle = str_replace('http://www. ... .nl/','',$vacaturetitle);

i also did a the following code
<input type='hidden' name='page_title' id='page_title' value='<?php echo $vacaturetitle; ?>' />
Nothing in the email is displayed..

When i print the variable in de template i see the good page title, but it isn't sending the title in the form.
GreyHead 06 Apr, 2014
Hi Janssen,

It's hard to work out exactly what code you are putting where. Without that information it's not possible to help you much :-(

Please read the FAQ carefully, it does what you are asking for if you follow it correctly.

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