Using Validation Class to validate Username and Password |
[eluser]chadsaun[/eluser]
I'm new to Codeigniter and need some help to figure out the best way to validate the username and password. This is what I have so far, but I want to setup some validation rule for validating if the username and password were found in the DB so that if it wasn't they'll see an error message. Code: function authorize() {
[eluser]Mark Skilbeck[/eluser]
You want to check out callbacks. Code: $this->form_validation->set_rules('username', 'Username', 'trim|required|max_length[50]|xss_clean|callback_username_exists');
[eluser]chadsaun[/eluser]
I looked at callbacks, but from what I understand the callback will only be passed the form field it was attached to. So you couldn't get both the username and password. How would I do this with a callback?
[eluser]Colin Williams[/eluser]
You can get the other fields' value in the callback with $this->input->post('other_field') |
Welcome Guest, Not a member yet? Register Sign In |