using referral in php contact form to store previous (referring) page
Hi,
I have a website with multiple links 'book now' to a contact form. I want my php contact form to record which 'book now' link was clicked through to the booking form. So I know without the customer telling me, which part of the website they are coming from.
On the sales page:
Code:
<a href="<?php echo($domain); ?>/contact.php"><img src="book.gif" alt="Book Now" border="0" /></a>
Then we use POST on the contact form and here is an example of the code (in part):
Code:
<?php
if(isset($_POST['Submitted'])) {
unset($message);
XXX
if(!count($Errors)) {
$SendTo = "XXX";
$Subject = "".$_POST['name']. ": booking";
$FromString = "From: ".$_POST['email']."\r\n";
$Indhold .= "I found the website by: ".$_POST['source']."\n";
$Indhold .= "Looking at this tour: ".$_POST['tourname']."\n";
if(@!mail($SendTo,$Subject,$Indhold,$FromString)) {
I found the following thread which is very close to what I am trying to achieve.
webdeveloper...Display-URL-of-previous-page
Here is the thing, I have a few links to the contact form on each URL (the same page, different tour codes linking to same contact form). So I can't use
Code:
$ref = getenv("HTTP_REFERER");
as I will still not know exactly which tour they were looking at.
So I guess each link needs to have it's own variable, but I can't see how to store this on my contact page.
Any help appreciated.
Thanks,
Andy