Maybe I didn't explain enough. What if they come from b.php or c.php. How do I automatically log what page they tried to access. So hard coding login.php?next=a.php would only work for one page.
TIA -----Original Message----- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: July 22, 2003 4:16 PM To: PHP Subject: Re: [PHP] Redirection Question * Thus wrote Beauford.2005 ([EMAIL PROTECTED]): > Hi, > > I am trying to figure out how to redirect a user back to a page but > not having much luck. > > For example: I click on a menu item on my site which goes to a.php. > This file includes another file that determines if they are logged in > or not. If not, they are sent to login.php using header(:Location: > .... ). How would I automatically redirect them back to a.php after > they have logged in successfully. I have tried using HTTP_REFERRER, > but it isn't redirecting. You can use the HTTP_REFERRER, but i wouldn't depend on it, it isn't a required header for the client. what you prolbably should do is when the arn't logged int, you can send them to something like: header('location: login.php?next=a.php'); Then on your login form add a hidden variable: <input type="hidden" name="next" value="<?echo $_GET['next']?>"> Finally when the user submits this form, and the user logs in successfully you know that you need to redirect them to the a.php. HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php