redirecting<

liunx

Guest
if i usually redirect using
$go = 'page_name'; (this is a dynamic page name)
header("Location: $go");
but want to occassionly redirect to another page
is there anyway i can do this
i tried meta and it was ignored and figured js would also be ignoredmeta was ignored? never heard of that before.

i take it you wrote:

<meta http-equiv="Refresh" content="3;blah.php" />

in your <head> section...this is what i had
$go = $ROOT.$_SESSION['page_name'];
header("Location: $go");
..................

if ($firstAccess == "yes")
{

<html><head>
< meta http-equiv= "refresh" content= "3;url=password.php" >
</head></html>

exit;
}

i guess the php code is already sent to the server for redirectionyup - you need to do something to disable that PHP code sending the header...


if ($firstAccess == "no")
{
$go = $ROOT.$_SESSION['page_name'];

}
else
{
$go = "password.php";
}

header("Location: ". $go);


(I changed the parameter in the header function slightly - i just prefer to seperae variables from strings..)thanks that works
i thought
header("Location: ". $go);
had to be at the top of the pageit has to be before any html content is sent - but other than that...Not necessarily, you can use output buffers.
<!-- m --><a class="postlink" href="http://us3.php.net/manual/en/function.ob-start.php?PHPSESSID=36bac9fb4adb6d535712cf0b7a6a8adebut">http://us3.php.net/manual/en/function.o ... a6a8adebut</a><!-- m --> you are delaying HTML output by using that buffer...Originally posted by Horus_Kol
but you are delaying HTML output by using that buffer...

I've read a lot about the buffering used in IIS (which would be the same concept there) and it's actually favored to buffer sometimes rather than not - all depends on the page/site you're working on.

I'm also going to slide this into the PHP forum - for posterity's sake :D
 
Back
Top