I don't have much knowledge in HTML/PHP programming. So upon searching online, I found a template code that looks like below:
In my .html page:
<form action="mail.php" method="POST"> <p>Name</p> <input type="text" name="name"> <p>Email</p> <input type="text" name="email"> <input type="submit" value="Send"> </form>
And in my mail.php:
<?php $name = $_POST['name']; $email = $_POST['email']; $formcontent="From: $name"; $recipient = "[email protected]"; $subject = "Subscription Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!"; ?>
So far, the above is working. BUT I also want to automatically include the referring page on the form, that is the page within my website where they submitted the info in the subscription form. Because the subscription form will be on many different pages of the site, obtaining this information is valuable so I know what page is generating the most subscription.
I understand that there's a feature called "HTTP_REFERER"
But I don't know how to code and where to put that code so that the referral link will also be submitted on the email.
Can someone help with what I need to do or add using the sample codes I used above?
Note that I understand security issues but this is only a basic sample form (security modifications will be added later on) and I just need to know how HTTP_REFERER can be added.