Welcome Guest, Not a member yet? Register   Sign In
validation php error with falidation fails
#4

[eluser]allibubba[/eluser]
thanks for taking a look at this, i still haven't figured this out yet though...

here's line 195 from Validation.php
Quote:line 195 : $ex = explode(’|’, $rules);
which i then looked into my rules to see if i had missed any pipes and joined two rules, but they are all there

and rules are set with $data
Code:
$this->validation->set_rules($data);

here's my validation check
Code:
//set validation error output
        $this->validation->set_error_delimiters('<p class="error">', '</p>');
        if ($this->validation->run() == FALSE){
            // load layout        
            $this->layout->defaultLayout('contact_page',$data);
        }else{
            $this->db->insert('users', $_POST);
            
            //redirect after submitting
            redirect('contact/register_success');
        }

as for the callbacks, they all appear to be working, but here they are jsut in case i'm missing anything:

Code:
function email_check($str){
        //check if email addresses match
        if($_POST['emailaddress'] != $_POST['emailaddressconfirm']) {
            $this->validation->set_message('email_check', 'Email does not match.');
            return FALSE;
        }else {
            return TRUE;
        }
    }    
    function password_check($str){
        //check if passwords match
        if($_POST['password'] != $_POST['passwordconfirm']) {
            $this->validation->set_message('password_check', 'Passwords do not match.');
            return FALSE;
        }else {
            return TRUE;
        }
    }    
    function level_check($str){
        //check if default level is set to private
        if($_POST['level'] != 'private') {
            $this->validation->set_message('level_check', 'STOP... HAMMER TIME, you can only enlist as a private.');
            return FALSE;
        }else {
            return TRUE;
        }
    }    
    function login_check($str){
        //check if login exists, limit only to unique login names
        $this->db->where('login', $str);
                $data['query'] = $this->db->get('users');
        if(count($data['query']) > 0) {
            $this->validation->set_message('login_check', $str.' is already registered, please select something else');
            return FALSE;
        }else {
            return TRUE;
        }
    }

also, quick sub question. does this look like the best way to be validation these form fields, with several callbacks, or should i combine my callbacks into one function, and only have a callback on my last input?

thanks for the help so far.


Messages In This Thread
validation php error with falidation fails - by El Forum - 06-14-2008, 04:29 PM
validation php error with falidation fails - by El Forum - 06-14-2008, 04:38 PM
validation php error with falidation fails - by El Forum - 06-14-2008, 05:51 PM
validation php error with falidation fails - by El Forum - 06-15-2008, 10:48 PM
validation php error with falidation fails - by El Forum - 06-15-2008, 11:52 PM
validation php error with falidation fails - by El Forum - 06-16-2008, 02:15 AM
validation php error with falidation fails - by El Forum - 06-16-2008, 08:23 AM
validation php error with falidation fails - by El Forum - 06-16-2008, 09:00 AM
validation php error with falidation fails - by El Forum - 06-16-2008, 10:31 AM
validation php error with falidation fails - by El Forum - 06-16-2008, 09:57 PM
validation php error with falidation fails - by El Forum - 06-17-2008, 02:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB