View Full Version : previously visited page

03-24-2007, 05:33 PM
How would you get the previous page's url in php code
I want to have a link to the page the user just came from but it could have been a number of different pages.


03-24-2007, 08:43 PM
Use the superglobal to know where they came from:


03-24-2007, 11:52 PM
Unfortunately $HTTP_REFERER is not foolproof. Some browsers do not send this information, or can be made to send false information. You should keep this in mind when working with $HTTP_REFERER.

03-25-2007, 01:09 AM
Use a session and setup tracking. :) Navigation History baby! OR just update the database with there history for every page they click if you dont want to use sessions. Thats fool proof :)

Use $_SERVER['REQUEST_URI']; for the "present" URL.