Ashley M. Kirchner wrote:
I have a form with various fields on it that I want to make sure aren't empty or the user didn't just hit the space bar or return (in a text field). What's the best way to do this? Seems empty() will fail on a textarea if the user simply hits a space or return and submits the form.

You can always 'trim' before you do the empty check. Just assign to a variable first since empty doesn't do non-var expressions

$value = trim($value);
if (empty($value)) {
   // error not filled in
}

Of course, you'll also want to validate the data type is a string or number also, etc...and not an array. This is the goal of the up and coming input filtering features.

Dante

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to