I’m learning CI as we speak, and I’ve got a quick question for you guys. I’m currently using the form_validation function to help me with some quick validations. This works fine, but! If i wanted to validate a username or email that is already in use, how can i do this?
I’m guessing that i need a model and a method that check’s if the username or email is already in use. But how can i combine the false/true result given with the form_validation error messages?
In codeigniter the validation system supports callbacks, this permits you to extend the validation class to meet what you need, for example:
In your controller, change the “username” rule to this:
Then in your controller you can add a function called “username_check”:
And in your model:
Bye!!