Guest 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 Link to comment https://forums.phpfreaks.com/topic/228573-undefined-index/ 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 Link to comment https://forums.phpfreaks.com/topic/228573-undefined-index/#findComment-1178535 Share on other sites More sharing options...
Guest Posted February 23, 2011 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! Link to comment https://forums.phpfreaks.com/topic/228573-undefined-index/#findComment-1178757 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.