Spring Posted February 23, 2011 Share Posted February 23, 2011 I've done this before and I've never gotten this notice, why am I getting it now? <p> <center><form method = "post" action = ""> <input type = "text" name = "name"> <input type = "password" name = "pass"> <input type = "submit" name = "submit"> </form> </center> </p> '; if($_POST['submit']){ echo"blah"; } Notice: Undefined index: submit Quote Link to comment Share on other sites More sharing options...
denno020 Posted February 23, 2011 Share Posted February 23, 2011 Submit the form and then see if you still get the notice. (I'm pretty sure you won't) All it's doing is telling you that a form hasn't been submitted, $_POST['submit'] doesn't exist, which, for the first time the page is loaded, will certainly be the case. Once the form is submitted and the page is reloaded, $_POST['submit'] will exist, you won't get the notice, and your if statement will run. Denno Quote Link to comment Share on other sites More sharing options...
Spring Posted February 23, 2011 Author Share Posted February 23, 2011 Actually, it was my fault, being late at night I forgot to use if(isset($_POST['submit'])){ Sorry for wasting your time! Quote Link to comment 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.