December 2013
Intermediate to advanced
306 pages
6h 26m
English
The validation rules can also be used to prepare input for you. For example, you can trim() whitespace from the input or apply htmlspecialchars(). Any PHP function can be used, as long as that function accepts one parameter as an argument by default.
Let's assume that we want to trim() whitespaces from the beginning and end of the input and generate an md5 hash of the input:
$this->form_validation->set_rules('input_name', 'Input Name', 'trim|md5'); Read now
Unlock full access