Why isn't my CodeIgniter Form Validation working?

后端 未结 1 574
Happy的楠姐
Happy的楠姐 2021-01-22 05:41

I am trying to set up validation on a simple contact form that is created using the form helper. No validation at all occurs. What is wrong?

In the code below, the “good

相关标签:
1条回答
  • 2021-01-22 06:07

    It looks like you're not setting the validation rules according to the way the new Form_validation library does it (the user guide has a section on the new syntax). That seems to be the syntax for the old Validation library.

    Try this instead for your $config_rules array and see if your validation runs properly:

    $config_rules = array(
        array('field' => 'email', 'rules' => 'required'), 
        array('field' => 'message', 'rules' => 'required')
    );
    
    $this->form_validation->set_rules($config_rules);
    
    0 讨论(0)
提交回复
热议问题