خرید بک لینک

Vote count: 0

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.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 7 فروردين 1395 ساعت: 0:18

صفحه بندی