SEO forum : Search Engine Optimization Forum

SEO forum : Search Engine Optimization Forum (http://www.seo-guy.com/forum/index.php)
-   PHP forum (http://www.seo-guy.com/forum/forumdisplay.php?f=33)
-   -   Header Location Question (http://www.seo-guy.com/forum/showthread.php?t=13700)

terreri 08-09-2006 04:21 PM

Header Location Question
 
Hi,

I'm new to PHP and was wondering how to code to go back to the previous page after executing a script. I was told to use the following command:

header("Location: " . $_SERVER['HTTP_REFERER']);
exit;

Is this the best way to do this? Is there another way?

Thanks!

phoztech 09-11-2006 03:10 PM

be careful in that there can be no other output previous to that command meant for the screen.

The Webmaster 09-27-2006 09:41 AM

Quote:
Originally Posted by terreri
Hi,

I'm new to PHP and was wondering how to code to go back to the previous page after executing a script. I was told to use the following command:

header("Location: " . $_SERVER['HTTP_REFERER']);
exit;

Is this the best way to do this? Is there another way?

Thanks!


If you want to Automatically redirect the user to the previous page then its the shortest method.

If not then you can use JavaScript's history.back() too


All times are GMT -8. The time now is 02:51 PM.

Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.