Validating user input
Validating user input allows you to set rules against which input coming in from the user can be judged. For example, you may wish to enforce certain conditions on an e-mail field, most obviously checking for a valid e-mail syntax, but also the minimum and maximum length, and whether it is required. CodeIgniter can even look into a database and check for duplicate values. In this recipe, we're going to build a controller and view, which together will allow the user to input data and have it validated against rules that will be set; errors, if any, will be reported back to the user.
You'll need to be aware of a few things before getting started. The following is a table of all available CodeIgniter validation rules: ...