Suche…


Validieren Sie das Formularbeispiel

//  initialize library
$this->load->library('form_validation');  

$this->form_validation->set_rules('username', 'Username', 'required|max_length[20]'); // Add validation rules for require and max
$this->form_validation->set_rules('password', 'Password', 'required|matches[password]'); // Validation for the input match
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required'); 
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[userTable.emailColumn'); // add validation for the email and check the emailColumn in userTable for unique value
$this->form_validation->set_message('is_unique', 'The %s is already taken, Please use another %s'); // add message for the is_unique

if ($this->form_validation->run()  === FALSE)
{
        // fail 
}
else
{
        // success
}

Verknüpfung



Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow