Username: Posted September 18, 2010 Share Posted September 18, 2010 How can I block a text that contains only spaces? Right now I have done if ($body == "") { die("<font color='red'><font size='15'><strong><center>Your post did not contain any text!"); } But that's extremely insufficient, as any user can easily post " " Any ideas? Link to comment https://forums.phpfreaks.com/topic/213705-blocking-spaces/ Share on other sites More sharing options...
Pikachu2000 Posted September 18, 2010 Share Posted September 18, 2010 $var = trim($var); if(strlen($var) == 0) { // only spaces were in $var } Link to comment https://forums.phpfreaks.com/topic/213705-blocking-spaces/#findComment-1112346 Share on other sites More sharing options...
Username: Posted September 18, 2010 Author Share Posted September 18, 2010 $var = trim($var); if(strlen($var) == 0) { // only spaces were in $var } Works great, thanks! Link to comment https://forums.phpfreaks.com/topic/213705-blocking-spaces/#findComment-1112347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.