[eluser]Jay Logan[/eluser]
I just can't seem to wrap my head around why the following code will not display form errors. I believe that the form processing is checking the rules though because it will not log a user in if the fields are blank. It just reloads the page. Does anyone see any noticeable errors with the code below?
Controller:
Code:
function in()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('user_name', 'User Name', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == FALSE) {
$this->layout->view('manage/log_in');
} else {
$this->load->model('auth_model');
$user_id = $this->auth_model->check_auth($this->input->post('user_name'), $this->input->post('password'));
if ($user_id) {
$this->session->set_userdata('user_id', $user_id);
redirect('manage');
} else {
redirect('manage/log/in');
}
}
}
View
Code:
<?php if (validation_errors() == TRUE): ?>
<div class="login_message message error">
<?= validation_errors() ?>
</div>
<?php endif; ?>