dan_t Posted March 30, 2011 Share Posted March 30, 2011 How do you use a header function in a switch case? .... Or can you? Like this-if this makes any sense: switch($id) { case "prima": header("Location: www.prima-tech.com/"); break; case "php": header("Location: http://www.php.net/"); break; case "slashdot": header("Location: http://www.slashdot.org/"); break; case "linuxchix": header("Location: http://www.linuxchix.org/"); break; default: header("Location: www.google.com/"); } exit; I was using it with a small made up form, but never got it to work. Say hey Kev!!!! Congrats! Link to comment https://forums.phpfreaks.com/topic/232117-urls-in-switch-function/ Share on other sites More sharing options...
trq Posted March 30, 2011 Share Posted March 30, 2011 There is nothing wrong with your code (excepting that www.google.com is not a valid url) . You better describe your actual problem. Where is $id defined? Link to comment https://forums.phpfreaks.com/topic/232117-urls-in-switch-function/#findComment-1193956 Share on other sites More sharing options...
dan_t Posted March 30, 2011 Author Share Posted March 30, 2011 Thanks!! I had Forgotten the: $id = $_POST['id']; It worked perfectly when that was added. Once again Thank you. Link to comment https://forums.phpfreaks.com/topic/232117-urls-in-switch-function/#findComment-1193962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.