Re: weird header() (bug may be)

From: Date: Thu, 12 Feb 2004 13:28:58 +0000
Subject: Re: weird header() (bug may be)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177513@lists.php.net to get a copy of this message
adwinwijaya wrote:
Hello php-generaler's , I have a script like this : if($foo == 'something'){
          header('Location:to_another_page.php') ;
}else {
       do another thing in here
} header('Location:to_previous_page.php'); I got a problem ... when $foo == 'something' .. it wont redirect me to to_another_page.php .... but if I put die(); after calling header(); .. it will work ... is this the bug ? I use php 4.3.4 ... and Apache 2.x thanks
Another thing you need to know, header checks if the same header was output before, if yes, it is owerwriten by the second one. So if you write: header('Location: foo.php'); header('Location: bar.php'); only one header is output. You can pass false as the second parameter to header (replace parameter), in this case both headers are output.

« previous php.general (#177513) next »