nblackwood Posted September 7, 2009 Share Posted September 7, 2009 how would i use php to verify that a user has input something into a text field, and either deny or let them continue based on that input? Link to comment https://forums.phpfreaks.com/topic/173421-solved-input-verification/ Share on other sites More sharing options...
dave_sticky Posted September 7, 2009 Share Posted September 7, 2009 if($_POST['field1'] != "") { // Let them continue } else { // Give them the form back } Of course if they enter anything (even a space) into the input box, it'll allow them to continue... [EDIT] Probably a better way of doing it would be something like: $defaults = array(""," ","0","-"); if(!in_array($_POST['field1'],$defaults)) { // Allow user to continue } else { // Give user the form again } Then you can just add as many options that you don't want people to be able to enter to the $defaults array as you like. Link to comment https://forums.phpfreaks.com/topic/173421-solved-input-verification/#findComment-914198 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.