objnoob Posted November 13, 2010 Share Posted November 13, 2010 For some reason the line commented // executes unexectedly does exactly that Any ideas why? if ($_POST['user'] == null){ $errors[] = 'An Interviewer ID is Required'; }elseif ($_POST['task'] != 'receipting' || $_POST['task'] != 'dataentry'){ $errors[] = 'Invalid Task'; // EXECUTES UNEXPECTEDLY } if (!empty($errors)){ print_LoginForm($errors); } echo "</b><select name='task'>\n"; echo "<option value='receipting'>Receipting</option>\n"; echo "<option value='dataentry'>Data Entry</option>\n"; echo "</select>\n"; Link to comment https://forums.phpfreaks.com/topic/218599-strange-result-validating-user-supplied-data/ Share on other sites More sharing options...
Pikachu2000 Posted November 13, 2010 Share Posted November 13, 2010 Assuming that $_POST['task'] must equal either 'receipting' or 'dataentry', change || to &&. Link to comment https://forums.phpfreaks.com/topic/218599-strange-result-validating-user-supplied-data/#findComment-1133910 Share on other sites More sharing options...
objnoob Posted November 13, 2010 Author Share Posted November 13, 2010 Heh. My first idea was to check whether it == 'receipting' || == 'dataentry', but then I decided to check whether it != and managed to get my operator thought process screwed. Thanks Pika Link to comment https://forums.phpfreaks.com/topic/218599-strange-result-validating-user-supplied-data/#findComment-1133911 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.