CodeIgniter form validation - how to make it case insensitive?

Any PHP function which accepts one parameter can be used in the validation class.

Any PHP function which accepts one parameter can be used in the validation class. From the manual Any native PHP function that accepts one parameter can be used as a rule, like htmlspecialchars, trim, MD5, etc. Which means you can just amend your validation rule to $this->form_validation->set_rules('email', 'Email', 'required|valid_email|strtolower|trim'); Note the use of the strtolower() function in the rules.

You need to create a callback function inside your controller: function valid_case_insensitive_email($str){ $str = strtolower($str) return $this->form_validation->valid_email($str) } Then modify the set_rules to this $this->form_validation->set_rules('email', 'Email', 'required|callback_valid_case_insensitive_email|trim'); Alternatively you could extend the form_validation class and overwrite the valid_email function.

Do this as: $this->form_validation->set_rules('email', 'Email', 'required|callback__check_email'); //then the callback function function _check_email() { $email = strtolower($this->input->post("email"); $email = trim($email); return $this->form_validation->valid_email($email); } Hope it helps.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions