Forum Moderators: coopster
We are trying to "include" a left hand side (LHS) menu on all our product pages, where one of the links within the LHS menu is an enquiry link. If we do this, we will not be able to determine which product page using the LHS menu was calling the enquiry link. That is we will not be able to use a link like: [mysite...]
If the product pages were called sensible names for example greenWidget.php - would it be ok for me to look at HTTP_REFERER within the enquiry page in order to record which product page was calling it?
if a visitor came from a search engine and arrived on a product page, to get to the enquiryform they would still need to click on the enquiry link on the LHS menu. So the HTTP_REFERER would be reset to the product page (i think?)
It appears to work ok, but i was wondering (because i am no expert) whether there was perhaps something that i have not thought about, and should consider?
Many thanks for your help
Alina
You could try using a cookie, but some browsers will block the cookie. This is why PHP session tracking and phpBB session tracking use URL request variables information
Your best bet would be to pass the information as part of the URL as in:
moreinfo.php?productid=999
This will set the global variable "$_GET['productid']" to "999" which you can use for tracking.
What i am referring to are, local pages on the server - after a visitor has landed - that are calling the enquiry page. I have done a check and saw that HTTP_REFERER was being set correctly.
Would what you are saying - still be a problem? If a visitor is viewing a webpage - after landing, wouldn't our server then be setting HTTP_REFERER?
Many thanks for you help
Alina
Would what you are saying - still be a problem? If a visitor is viewing a webpage - after landing, wouldn't our server then be setting HTTP_REFERER?
Yes, it would still be a problem. The HTTP_REFERER field is dependant on the client (browser) and proxy servers, all of which are out of your control. So even after a user has landed, the referer may be blank.
$_SERVER["PHP_SELF"] or
$_SERVER["SCRIPT_NAME"] then something like
$q=$_SERVER["QUERY_STRING"]; $p=$_SERVER["SCRIPT_NAME"]; $thislink="enquiry.php?".$q."&camefrom=".$p."&otherstuff ... "; echo "<a href='".$thislink."'>Link</a><br />\n"; On the enquiry page, grab
$_SERVER["camefrom"] as your "referrer". (BTW, to paraphrase gliff: Not all browsers/users allow the referrer to be passed, which is what makes it unreliable: it may or may not be there to see.)