Capturing Referring Page when redirected
Posted on 2012-03-11
I need to be able to capture a variable on a redirect
The code works like this:
if user is logged in send user to page review?id=1234 (this works as expected)
other wise they are sent to the login page main.php with the code below:
Then on main.php when the user logs in they are returned back to the page that they were previously on based on the
$_SERVER['HTTP_REFERER'] rather than review?id=1234
For some reason because I am using the header function to redirect it doesn't count the page that it was trying to access as the referrer page it counts the page that the user was previously on.
What I need to be able to do is capture the page the user would have accessed if they were logged in so I can redirect them there after they login. The ID in the URL references a unique product ID that provides information on the product based on that ID.