CI's form validation class: Checking data easily

One task, when you write HTML forms, is validating user input. We all know that we should do it, but so far we've written a simple form, which will trustingly accept any data the user enters. You should always assume that a minority of your users are malicious, and the others could make some mistakes too. Validating your form tests the information they submit, to make sure it fits rules you specify.

You can do it on the client side, using JavaScript, but this is of limited value as a security precaution, as the user can easily circumvent it. Validating the data on the server side means an extra round trip to the server, but it's worth it, for the added peace of mind.

It's also quite complex to write ...

Get CodeIgniter 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.