lheonx Posted September 26, 2009 Share Posted September 26, 2009 Notice: Undefined index: submit in C:\Program Files\EasyPHP 2.0b1\www\index.php on line 5 <html> <head></head> <body> <?php if (!$_POST['submit']) <----- this is the line 5 { // form not submitted ?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> Username: <input type="text" name="username"><br> Password: <input type="password" name="password"> <br><br> <input type="submit" value="Sign Up" name="submit" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/175591-submit-problem-in-line-5/ Share on other sites More sharing options...
monkeytooth Posted September 26, 2009 Share Posted September 26, 2009 <?php if (!$_POST['submit']) <----- this is the line 5 { // form not submitted ?> Your missing the trailing (closing) bracket.. "}" <?php if (!$_POST['submit']) <----- this is the line 5 { // form not submitted } ?> Quote Link to comment https://forums.phpfreaks.com/topic/175591-submit-problem-in-line-5/#findComment-925281 Share on other sites More sharing options...
PFMaBiSmAd Posted September 26, 2009 Share Posted September 26, 2009 The code: if (!$_POST['submit']) causes the the post variable to be evaluated. However, when the variable does not exist (your form has not been submitted yet) that generates an error. You need to use isset() to prevent that specific error for a variable that optionally might not exist - if (!isset($_POST['submit'])) Quote Link to comment https://forums.phpfreaks.com/topic/175591-submit-problem-in-line-5/#findComment-925301 Share on other sites More sharing options...
hamza Posted September 26, 2009 Share Posted September 26, 2009 <?php if (!$_POST['submit']) <----- this is the line 5 { // form not submitted } ?> when you enable in php.ini or use in any php file this funcion ERROR REPORTING then it will tell you proper and all possible errors in your php page. and over here in your code you sould write like this if ( !isset($_POST['submit']) ) { // do what every } if ( !empty($_POST['submit']) ) { // do what every } Quote Link to comment https://forums.phpfreaks.com/topic/175591-submit-problem-in-line-5/#findComment-925346 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.