gohmdoree Posted December 13, 2010 Share Posted December 13, 2010 I've gotten different "Notices" for "Undefined Index." For different $_POST['vars'], I've corrected with adding an isset() at the top of my if condition. I'm stumped now for how to approach my current notice. Am tempted to just block errors on my server, but don't believe that is really fixing it. I've added a multiple select array to my form. I pass it correctly and access it fine. Only thing, for checking with error checking, if it is blank, the form will repopulate. If checked, the data passes correctly. If there are no selections, then I get the Undefined Index error from PHP. I wrote a routine to check if it is null, but that doesn't seem to do it. I want to check that it is not null, and if it is, then repost the form. If I put in isset(), it would never go past. If I don't put isset(), then it will cry with the error. Any Thoughts? Quote Link to comment Share on other sites More sharing options...
gohmdoree Posted December 13, 2010 Author Share Posted December 13, 2010 After reading the isset() man pages, instead of doing a condition like below if (($_POST['item_no'] == '') || ($_POST['item_width'] == '') || ($_POST['item_description'] == '') || ($_POST['categories'] == null) || ($_POST['compositions'] == null) || ($_POST['colors'] == null) || ($_POST['patterns'] == null)){ seems like doing a condition as: if (isset($_POST['item_no'], $_POST['item_width'], $_POST['item_description'], $_POST['categories'], $_POST['compositions'], $_POST['colors'], $_POST['patterns']){ }else{ } might be the solution. Only thing, if I tried passing and it wasn't set, get the same error. Would I need a long conditional statement checking each item, posting the form accordingly, depending on if it is set or not, and pass an empty string. Quote Link to comment Share on other sites More sharing options...
gohmdoree Posted December 13, 2010 Author Share Posted December 13, 2010 Just preceded each $_POST['var'] with isset, and got rid of the error. 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.