I have seen many other questions which mostly ask how to prevent spaces from being entered in the whole textarea, but I am wondering how I can check if the textarea just contains spaces?
For example, here is my textarea:
<textarea id='textarea' name='msg' rows='2' maxlength='255' cols='80' placeholder=' Share a thought...'></textarea>
I can easily check if the above is empty by doing:
$post_msg = htmlentities(strip_tags(@$_POST['msg']));
$post_msg=mysqli_real_escape_string($coect,$post_msg);
if ($post_msg != "") {
// do this
}
But, if a user enters just space characters in, then the field is obviously not empty no more, invalidating the above check. How can I check if the user has entered space characters?
A message can start off with space characters, but it caot only be space chars.
