TheSky Posted April 23, 2011 Share Posted April 23, 2011 hey im stuck on matching id = case or else dont exist any help will be welcome <?php $msg=$_GET['id']; if ($msg('id') == 'case'); switch($msg){ case 301: echo "301 Moved Permanently"; break; case 302: echo "302 Found"; break; case 303: echo "303 See Other"; break; case 403: echo "403 Forbidden"; break; case 404: echo "404 Not Found"; break; } else { echo "This error dont exist" } ?> Quote Link to comment https://forums.phpfreaks.com/topic/234517-syntax-error/ Share on other sites More sharing options...
fugix Posted April 23, 2011 Share Posted April 23, 2011 what errors do you receive when running this script? Quote Link to comment https://forums.phpfreaks.com/topic/234517-syntax-error/#findComment-1205227 Share on other sites More sharing options...
Pikachu2000 Posted April 23, 2011 Share Posted April 23, 2011 switch doesn't use an else{}, it would use a default: See the manual entry for switch, and look at the fourth block of code in example #2. Quote Link to comment https://forums.phpfreaks.com/topic/234517-syntax-error/#findComment-1205229 Share on other sites More sharing options...
fugix Posted April 23, 2011 Share Posted April 23, 2011 so after case 404 you would put default and echo whatever you would like the default text to be Quote Link to comment https://forums.phpfreaks.com/topic/234517-syntax-error/#findComment-1205230 Share on other sites More sharing options...
TheSky Posted April 23, 2011 Author Share Posted April 23, 2011 oh then there is no way to check? Quote Link to comment https://forums.phpfreaks.com/topic/234517-syntax-error/#findComment-1205231 Share on other sites More sharing options...
TheSky Posted April 23, 2011 Author Share Posted April 23, 2011 thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/234517-syntax-error/#findComment-1205233 Share on other sites More sharing options...
fugix Posted April 23, 2011 Share Posted April 23, 2011 glad we could help Quote Link to comment https://forums.phpfreaks.com/topic/234517-syntax-error/#findComment-1205235 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.