Preparing user input

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.

How to do it...

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'), 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.131.178