[PHP] Is there a referring page or URL variable?

Associate
Joined
29 May 2003
Posts
2,038
Location
Cambridge
Is there any global variable - like the superglobals used for handling user input from forms - that holds the page or URL that a browser was showing before visiting the current page? I've had my head in my PHP books for the last ten minutes and haven't found anything yet - although I may well be looking for something that doesn't exist or is named entirely different to what I'm expecting, of course ...

What I'd like to do is have a link to a particular page on all the other pages in a site and show different content on that target page depending on which of the linking pages the user arrived from, or show a 'standard' page if the user arrives from outside the site - is there any simple way of doing that? I can just about grasp how to display that content using an 'if...then' or maybe even a 'case' conditional statement, but it's having a record of the referring page that's got me beat at the moment ...

Thanks in advance gents :)
 
I tend to browse with it disabled :).
If I need to track internal referrals, I use a session variable or pass the referring page through the url with something like base64_encode(). I generally consider $_SERVER['HTTP_REFERER'] useless and unusable.
 
Back
Top Bottom