Welcome Guest, Not a member yet? Register   Sign In
Could Use Some Fresh Eyes - Form Validation Problem
#1

[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">
        &lt;?= validation_errors() ?&gt;
    </div>
    
&lt;?php endif; ?&gt;


Messages In This Thread
Could Use Some Fresh Eyes - Form Validation Problem - by El Forum - 02-18-2010, 06:47 AM
Could Use Some Fresh Eyes - Form Validation Problem - by El Forum - 02-18-2010, 07:44 AM
Could Use Some Fresh Eyes - Form Validation Problem - by El Forum - 02-18-2010, 08:11 AM
Could Use Some Fresh Eyes - Form Validation Problem - by El Forum - 02-18-2010, 08:27 AM
Could Use Some Fresh Eyes - Form Validation Problem - by El Forum - 02-18-2010, 08:34 AM
Could Use Some Fresh Eyes - Form Validation Problem - by El Forum - 02-18-2010, 08:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB