2015-02-10 127 views
0

我有这种形式的工作,说实话我无法弄清楚我可能做了什么。表单现在不会提交,我也没有看到任何表单验证错误。Codeigniter表单验证不提交表单,没有错误

控制器:

$this->load->library('form_validation'); 
    $this->form_validation->set_error_delimiters('<div class="ncerror" >', '</div>'); 
    $this->form_validation->set_rules('media_consent', 'Media Consent', 'required'); 
    $this->form_validation->set_rules('aic_name', 'Name', 'required'); 
    $this->form_validation->set_rules('aic_phone', 'Cell phone', 'required'); 
    $this->form_validation->set_rules('aic_email', 'Email', 'required'); 

    if ($this->form_validation->run() == FALSE) { 
     $data = $this->ncformdata(); 
     $this->load->view('templates/sponsorheader', array('title' => 'National Convention Registration')); 

     var_export($_POST); 
     $this->load->view('ncform', $this->ncformdata()); 
     $this->load->view('templates/footer2'); 
    } 

<?php echo "errors" . validation_errors(); 

在我的窗体的顶部。提交表单后,表单将重新加载显示的“错误”,但没有其他来自validation_errors函数的输出。任何帮助解决问题?

回答

0

应此行

$this->load->view('ncform', $this->ncformdata()); 

是这样?

$this->load->view('ncform', $data); 
0

你有一个条件,当

$这个 - > form_validation->的run()== FALSE

,但我看不到任何对当表单验证的回报条件真正。尝试添加条件时

$这 - > form_validation->的run()== TRUE

实施例:

if ($this->form_validation->run() == FALSE) { 
     $data = $this->ncformdata(); 
     $this->load->view('templates/sponsorheader', array('title' => 'National Convention Registration')); 
     var_export($_POST); 
     $this->load->view('ncform', $this->ncformdata()); 
     $this->load->view('templates/footer2'); 

} 
else 
{ 
     echo 'There are no form validation errors!.'; 
}