views:

467

answers:

2

Hi

I'm validating allot of fields now in PHP, and I have to preform basic (string length ect.) and more complex (strip <> tags, for example)

Can anyone recommend a class that does this, or maybe a framework, or maybe some functions that do these things?

+5  A: 

I assume you're validating POSTed forms: use Zend_Form and Zend_Filter

Keeper
For modularity, Zend is a winner.
garrow
Couldn't recommend Zend_Form any more strongly, see http://pastebin.com/m3a0b3857 for an example of how easy adding validators and filters is
David Caunt
+1  A: 

If you're using PHP >= 5.2.0 then you can use PHP's built in filter functions. In particular, have a look at filter_var_array, which you can use to validate an array of inputs, each with its own validation rules. If you don't want to buy in to a complete framework then these might prove useful.

Alternatively, I've found Kohana's validation library to be very good.

D. Evans