Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Validation

Hello guys,

I can't seem to get the validation to work correctly. I'm not getting any errors to check against. It doesn't display the error if the form doesn't have any data when posted. I'd rather use this validation library rather than the form_validation() library.

Thanks for any help you can give me.

class Login extends Controller {

    // Validate user then set the session using session helper.
    function index() {
        $rules['email'] =  "trim|required|valid_email";
        $rules['password'] = "trim|required|min_length[6]";
        // Check if all feilds have been validated or return to is_not_logged_in() function.
            if ( $this->validation->run() == FALSE ) {
            } else {
                // run query to see if email and password exists in db before creating session.
                $query = $this->membership_model->validate();
                if($query) {
                    $data = array(
                        'email' => $this->input->post('email'),
                        'is_logged_in' => true
                } else {
                    // No user was found so reload view;
    function is_not_logged_in() {
        $data['main_content'] = 'site/login_view';
        $this->load->view('site_template/template', $data);

My login_view has the following to display the error:

&lt;?=validation_errors('<p class="error_msg">') ?&gt;

Theme © iAndrew 2016 - Forum software by © MyBB