On a website I’m making, I would like to know how a user landed on a particular page (say here.php). There could be two possible ways: by clicking the link on page1.php or the link on page2.php. How can I find out how the user reached, so that I can provide content according to that.
Share
HTTP_REFERER
$_SERVER['HTTP_REFERER']DOCs should give you page the user has arrived from:Using a session
If you want to track a users progress through your site then it would be easier/safer to set a session (
session_start()DOCs) and use that to track them as they land on your pages.