Page 1 of 1
Redirecting a user
Posted: Wed Mar 24, 2004 5:53 am
by insane
Say for example you have two variables. If their values are both the same then the user must be directed to a certian page and if the variables are not the same then the user must be taken to a diffrent page. I searched the internet for a php script but could'nt actuaualy find anything. Does any one have an idea on what command/script to use?
Posted: Wed Mar 24, 2004 5:56 am
by markl999
Code: Select all
<?php
if($var1 === $var2){
header("Location: page1.php");
exit;
} else {
header("Location: page2.php");
exit;
}
?>
or you could just include/require different php files instead of redirecting.
Posted: Wed Mar 24, 2004 11:16 am
by werlop
Just remember if your gonna use headers to do it, you can't have any script output, even a space, before the header function. That's a common mistake.
Posted: Wed Mar 24, 2004 12:09 pm
by malcolmboston
ive got a solution
buy 20 more server
like i said though, i dont understand these problems as i have never suffered from any!?
maybe ive just been lucky so far