how to determine what page the user came from

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

how to determine what page the user came from

Post by jasongr »

Hello

I need to know what page the user came from.
Assume that the page the user came from is within my domain
I don't want to rely on the browser history object as it seems to not reliable
is there a construct in PHP that gives me that info?

regards
Jason
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Code: Select all

print_r($_SERVER);
Namely:

$_SERVER['HTTP_REFERER']

Don't rely on it though... it's not always set so you'll need to make sure its set first ;)
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

Post by jasongr »

thanks
Yes I am aware of this construct and its limitations
maybe I will use sessions
Post Reply