Forms provide a way for users to interact with the application and submit data.
What does the form validation in CodeIgniter:
- Check for required data.
- Verify that the data is of the correct type, and meets the correct criteria.
- Sanitize the data for security.
- Pre-format the data if needed (Does the data need to be trimmed? HTML encoded? Etc.)
- Prepare the data for insertion in the database.
CodeIgniter Validation Rules
To set validation rules you will use the set_rules() method:
$this->form_validation->set_rules();
The above method takes three parameters as input:
- The field name - the exact name you’ve given the form field.
- A “human