Welcome Guest, Not a member yet? Register   Sign In
With form_validation class, always jump to index function!
#1

[eluser]Unknown[/eluser]
Hi!I am a dummy to web programming.
In the following controller test.php, I have a function called register which loads a register_view page. After submiting username, password, email, the form is posted to test/create_user.
However,when I'm going to debug this fragment, I find that with form_validation class, test/create_user always leads me to the index of test. Although there are echo upon success of failure of form_validation, there's never message print.
Code:
function register()
    {
        $this->load->view('register_view');
    }
    
    function create_user()
    {
        $this->load->library('form_validation');
    

        $this->form_validation->set_rules('password', 'Password', 'required|trim|xss_clean');
        $this->form_validation->set_rules('email', 'Email', 'required|trim|xss_clean');
        $this->form_validation->set_rules('username', 'Your full name', 'required|trim|xss_clean');
        $this->form_validation->set_rules('repass', 'Re-entered password', 'required|trim|matches[password]');
    

        if($this->form_validation->run()==FALSE)
           echo "oops.";

        else
           echo "form is good";
    }//end of create_user

To be precise, I took fragment out of controller login.php, and tested it in test.php. I made it months ago. It worked well with form_validation at that time. But this time, teammate gave me her final version of web design, good luck ends!
I'm very confused now. Never met situation like this.


Messages In This Thread
With form_validation class, always jump to index function! - by El Forum - 05-16-2011, 03:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB