Analog Posted January 28, 2010 Posted January 28, 2010 Notice: Undefined index: action in C:\wamp\www\xxx\xxx\file.php on line 24 I know the error is coming from $_GET['action'] being empty during the first view of the file. So my question is.... Is there a way around this other than ditching the switch function and creating separate files for each case of the switch? I tried this but of course still get the error... if(!$_GET['action']) { $_GET['action'] = "default"; } Quote
iSOS Posted January 28, 2010 Posted January 28, 2010 You could use "isset()", http://uk.php.net/manual/en/function.isset.php Example: if(isset($_GET['action'])) { blah } Quote
Analog Posted January 28, 2010 Author Posted January 28, 2010 ohhh jeez.... I was really over thinking a solution to this.. lol Never even thought about isset() Quote
Equinox Posted January 29, 2010 Posted January 29, 2010 Another common way that people use is $_GET['action'] = (isset($_GET['action']) && is_string($_GET['action'])) ? stripslashes(trim($_GET['action'])) : FALSE; Quote
Analog Posted January 29, 2010 Author Posted January 29, 2010 That too Bertrand. Developing with error reporting set to ALL. Thought it could improve my coding quite a bit if I try to get rid of all types of errors. Quote
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.