When using PHP how can I validate a simple text input to check if the field only contains space character, I want to prevent it from being possible to sign up to my website with a blank name consisting of just spaces and the same goes for other inputs such as comments? If I check if it is empty it just returns it as not empty as it considers a space as a character regardless.
For future reference the answer was to first trim my post data:
$variable = mysql_real_escape_string(stripslashes(trim($_POST['field'])));
Also sanitised it here and then as for validation, you can then just use empty():
if(empty($variable)) {
//do something
}