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.

I often use trim() on *any* incoming data as the first step to sanitizing
the data - that gets rid of the whitespace problem you describe.

a second step often involves using strval(), intval(), floatval() et al.

subsequent steps might involve funcs like striptags() to remove any HTML
that some b****** might be trying to XSS your site with.

<sidenote>
in the future the filter extension will provide robust, standardized
ways to santize incoming data - I think it ill be a huge step forward.
</sidenote>

> 

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

Reply via email to