Welcome Guest, Not a member yet? Register   Sign In
Own Validation Function
#1

[eluser]cinewbie81[/eluser]
I have my own validation function - username_check as following:

Code:
$rules['username'] = "required|min_length[6]|max_length[20]|callback_username_check";
$rules['password'] = "required|min_length[6]|max_length[20]";
$this->validation->set_rules($rules);

$fields['username'] = 'User Name';
$fields['password'] = 'Password';
$this->validation->set_fields($fields);

function username_check($username)
{
    // I can get username value here, but how can i get password value here ??
}

My doubt now is: How can i get the password value in my username_check validation function ??
#2

[eluser]Michael Wales[/eluser]
There are three ways - each of which will return the same value:
Code:
$this->validation->password;
$this->input->post('password');
$_POST['password'];

These values are after the input has been run through your rules. For instance, if you had md5 within your rules, the returned value will be hashed.




Theme © iAndrew 2016 - Forum software by © MyBB