Btown2 Posted January 17, 2009 Share Posted January 17, 2009 ok heres the issue. Im trying to weed out entries that dont fill in all of the info. The issue is that my if statement isnt ever evaluating to true. Can anyone explain to me why? (it always runs the else block that calls the mail() function.) if(isset($_POST['incoming_data'])) { if(!isset($_POST['director']) || !isset($_POST['class']) || !isset($_POST['description'])) { echo "Error! All fields must be filled out!"; } else { $director = $_POST['director']; $room = $_POST['room']; $class = $_POST['class']; $description = $_POST['description']; //do a mail() call } } Quote Link to comment https://forums.phpfreaks.com/topic/141158-solved-easy-problem-im-sure/ Share on other sites More sharing options...
dclamp Posted January 17, 2009 Share Posted January 17, 2009 Every form value is always "set" per say. Try checking if the value is equal to nothing: if(isset($_POST['incoming_data'])) { if($_POST['director']=="" || $_POST['class']=="" || $_POST['description']=="") { echo "Error! All fields must be filled out!"; } else { $director = $_POST['director']; $room = $_POST['room']; $class = $_POST['class']; $description = $_POST['description']; //do a mail() call } } Quote Link to comment https://forums.phpfreaks.com/topic/141158-solved-easy-problem-im-sure/#findComment-738860 Share on other sites More sharing options...
Btown2 Posted January 17, 2009 Author Share Posted January 17, 2009 ok that worked, ty. Quote Link to comment https://forums.phpfreaks.com/topic/141158-solved-easy-problem-im-sure/#findComment-739163 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.