Joshua F Posted November 20, 2011 Share Posted November 20, 2011 I have a field that is 30 chars max, and I have the code checking if the string is empty upon submit, though if someone were to make that field spaces only, it will allow it, and run the query and insert the data. if (strlen($_POST['title']) <= (($userhandler->getRights() == 2) ? 100000 : 30) && strlen($_POST['message']) <= (($userhandler->getRights() == 2) ? 100000 : 2000) && !empty($_POST['title']) && !empty($_POST['message']) && $userhandler->getRights() >= 0) { Quote Link to comment https://forums.phpfreaks.com/topic/251470-disallow-space-only-string/ Share on other sites More sharing options...
Pikachu2000 Posted November 20, 2011 Share Posted November 20, 2011 trim Quote Link to comment https://forums.phpfreaks.com/topic/251470-disallow-space-only-string/#findComment-1289683 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.