PHPNewbie55 Posted December 20, 2007 Share Posted December 20, 2007 I started using <?php error_reporting(E_ALL); ?> At the beginning of all of my scripts... But now I can't do what I usually do without getting an error... If I start the script off like this with error_reporting(E_ALL); <?php error_reporting(E_ALL); if (!$action) { print "this"; } elseif ($action = "submit") { print "that"; } ?> I get an error message.. Notice: Undefined variable: action in /user/web/myurl.com/thefile.php on line 4 So how would I define this variable... because I thought that I was defining it by the if (!$action) and the elseif ($action = "submit") Quote Link to comment https://forums.phpfreaks.com/topic/82459-error-reporting-question/ Share on other sites More sharing options...
~n[EO]n~ Posted December 20, 2007 Share Posted December 20, 2007 Define action at the top <?php error_reporting(E_ALL); // keep it blank or keep any value you want $action = ""; if (!$action) { print "this"; } elseif ($action = "submit") { print "that"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/82459-error-reporting-question/#findComment-419227 Share on other sites More sharing options...
rajivgonsalves Posted December 20, 2007 Share Posted December 20, 2007 or your code should be <?php error_reporting(E_ALL); if (!isset($action)) { print "this"; } elseif (isset($action) && $action = "submit") { print "that"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/82459-error-reporting-question/#findComment-419241 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.