UnknownPlayer Posted September 13, 2010 Share Posted September 13, 2010 I made a form, like guestbook, and i dont wonna to write in mysql if in comment is just 1 or more spaces, no letters or numbers or chars, just space, how can i fix that? Link to comment https://forums.phpfreaks.com/topic/213296-spaces-in-php/ Share on other sites More sharing options...
Pikachu2000 Posted September 13, 2010 Share Posted September 13, 2010 You need to validate the form fields. $comment = trim($_POST['comment']); if( strlen($comment) < 5 ) { // or however many characters you want as a minimum // echo or store error message } else { // proceed } Link to comment https://forums.phpfreaks.com/topic/213296-spaces-in-php/#findComment-1110570 Share on other sites More sharing options...
UnknownPlayer Posted September 13, 2010 Author Share Posted September 13, 2010 Thank you. Link to comment https://forums.phpfreaks.com/topic/213296-spaces-in-php/#findComment-1110600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.