header('Location: '.$_SERVER['HTTP_REFERER']); not working..

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
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

header('Location: '.$_SERVER['HTTP_REFERER']); not working..

Post by JAB Creations »

This...

Code: Select all

header('Location: '.$_SERVER['HTTP_REFERER']);
...isn't working.

Lets say I am on page2.php. I click the sign-out script link which brings me to sign-out.php. Instead of redirecting me to the page I was on (page2.php) I get redirected to page1.php. I didn't sign-out on page1.php...I signed out on page2.php. I just want to get this to work please. :D
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Considering HTTP_REFERER isn't reliably set, I wouldn't use it.

Set the (proper) URL in a session variable.
Post Reply