Forum Moderators: coopster
I running a php and mysql. i have a form that executes a switch statement and depending on the case i want to redirect to different URL's e.g. case 1: redirect to www.google.com
case 2: redirect to www.yahoo.com.
Sample code i tried:
switch($redirect)
{
case "1":
header("Location: [google.com...]
break;
case "2":
header("Location: [yahoo.com...]
break;
}
i have tested the switch using echo statements and it works i just can't get it to redirect automatically.
Can anybody help?
thanks in advanced
scoobie
switch($redirect)
{
case "1":
google();
break;case "2":
yahoo();
break;
}function google(){
echo "<html><head><meta http-equiv='refresh' content='1; url=http://www.google.com'></head><body>Sending to google.</body></html>";
}function yahoo(){
echo "<html><head><meta http-equiv='refresh' content='1; url=http://www.yahoo.com'></head><body>Sending to yahoo.</body></html>";
}
Might not be the best way but it should work. Hope it helps. If not, I tried.