switch and case statements

I am trying to use a header(location) line of code inside a case statement on a process page. When i test the page it does not seem to redirect the browser it just stays on the process page. Can someone tell me if this can even work or if there is a different way to redirect based on info passed on from a previous page.

could u post these lines?

there must be no output before the header function is called.

u may use the url-header the url-http-equi-metatag or a javascript, but the location-header is the best choice.

<?php $type= $_GET['drop']; switch ($type) { case"Airfield": header ('location:airfield.html'); break; case"Amusement": header ('location:amusement.html'); break; case"Barge": header ('location:bargebuilding.html'); break; case"Barns": header ('location:barns.html'); break; }

I always use


echo “";


It works every time

That last code seemed to work but then after a few page changes it ends up getting stuck on my process page and never redirecting. It worked for about 3 clicks then after that it would just get stuck.

nevermind it all seems to be working good now

have u changed something?

ya i used the script code that andy posted and it worked very well and also i tried the header code again and the problem was that i had blank lines before i started my php and i was told that it can’t redirect if the is anything before i start my php code

Sponsor our Newsletter | Privacy Policy | Terms of Service