• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.