// 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[passw...