Forum Moderators: coopster
switch ($Header)
{
case Header(location:"http://www.1.com"):
Header(Location:"http://www.main.com/index1.html");
break;
case Header(location:"http://www.2.com"):
Header(Location:"http://www.main.com/index2.html");
break;
case Header(location:"http://www.3.com"):
Header(Location:"http://www.main.com/index3.html");
break;
case Header(location:"http://www.4.com"):
Header(location:"http://www.main.com/index4.html");
break;
default:
Header(Location:"http://www.main.com/index.html");
Header(location:"http://www.example.com")
This should give you a parse error. It needs to be
header("Location: http://www.example.com");
Even if you do that, though, your case statement will evaluate to the return value of the header function (which is void, so there is no return value in reality), not to a string of characters. So if your $header variable is set to "www.1.com" and you have the switch statement
switch ($header)
{
case header("Location: http://www.example.com"):
}
That is the same as
switch ($header)
{
case :
}
and I don't actually know what happens there (error, warning, notice, or silent), but it will never trigger that case.
You probably want something more along the lines of
switch ($header)
{
case "example.com":
case "example2.com":
case "example3.com":
header("Location: [$header");...]
exit;
default:
echo "Sorry, where was that you wanted to go?";
}