Forms provide a way for users to interact with the application and submit data. 

What does the form validation in CodeIgniter:

  1. Check for required data.
  2. Verify that the data is of the correct type, and meets the correct criteria. 
  3. Sanitize the data for security.
  4. Pre-format the data if needed (Does the data need to be trimmed? HTML encoded? Etc.)
  5. Prepare the data for insertion in the database. 

CodeIgniter Validation Rules 

To set validation rules you will use the set_rules() method:


The above method takes three parameters as input:

  1. The field name - the exact name you’ve given the form field.
  2. A “human