Where Did that Inquiry Come From? Contact Form Previous Page Detection in PHP
It’s great to see where contact forms are submitted from. It allows you to track which pages are effective in landing inquiries. In addition to the standard info (name, email, phone), you can also detect what pages they submitted the form from.
Here is one of our standard inquiry forms with data excluded:
=============
Name: ***********
Firm Name: ***********
Email: ***********
Phone: ***********
Question: Looking to update our current website: www. ***********.com. Could you provide us with a quote? Would like to add some photos and possibly video to our site and email contact option.
Referral Page: https://www.paperstreet.com/web-design/
=============
In that case, the person visited our web design page and submitted their info. How did we know that?” We used the HTTP_REFERER command.
Command to Use
‘HTTP_REFERER‘
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.
Code to Use
<?php echo “Referral Page: ” . $_SERVER[‘HTTP_REFERER’]; ?>
About Us
Did you know more than 200 clients have worked with PaperStreet for more than 10 years?