note 78967 added to function.header
| From: | Dazza at osu1 dot php dot net | Date: | Mon, 05 Nov 2007 04:51:55 +0000 |
| Subject: | note 78967 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132006@lists.php.net to get a copy of this message | ||
This happened to me with PHP5.
I couldn't work it out and then I read a post which gave me this code.
I changed it into a function... may need modifications made if you want to redirect outside your own
server.
function redirect($page){
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
header("Location: http://$host$uri/$page");
}
this is to be called with an exit clause afterwards.
This applies especially if you have more than one redirect in the same script.
Example...
if($this != $that){
redirect('mypage.php');
exit;
}
----
Server IP: 203.220.0.234
Probable Submitter: 203.161.122.210
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/78967
Del: integrated -- https://master.php.net/note/delete/78967/integrated
Del: useless -- https://master.php.net/note/delete/78967/useless
Del: bad code -- https://master.php.net/note/delete/78967/bad+code
Del: spam -- https://master.php.net/note/delete/78967/spam
Del: non-english -- https://master.php.net/note/delete/78967/non-english
Del: in docs -- https://master.php.net/note/delete/78967/in+docs
Del: other reasons-- https://master.php.net/note/delete/78967
Reject -- https://master.php.net/note/reject/78967
Search -- https://master.php.net/manage/user-notes.php