【问题标题】:Form Validate not running [closed]表单验证未运行[关闭]
【发布时间】:2012-09-25 02:55:28
【问题描述】:

我已阅读所有其他问题,包括 google 上的所有问题。这与我用于注册的相同方法之间没有明显区别。 这是一个非常基本的概念,并不想工作。

转储 $_POST 会显示正确的空字符串,因此某处出现了其他问题。

控制器

public function details(){
    $this->load->library('form_validation');
    //$this->form_validation->set_message('current-password', 'Incorrect password');
    $this->form_validation->set_rules('current-password', 'Password', 'required');
    $this->load->view('details', $data);
}

查看

<?php echo validation_errors(); ?>
<?php echo form_open('user/details'); ?>
    <input type="password" name="current-password" id="current-password" value=""/>
    <input type="submit" class="submit-save" value="save"/>
</form>

【问题讨论】:

    标签: php codeigniter validation


    【解决方案1】:

    你忘了实际运行表单验证:

    $this->form_validation->run()
    

    请看这里:http://codeigniter.com/user_guide/libraries/form_validation.html#tutorial

    【讨论】:

    • 哈哈哈,太棒了 :D 压力很大
    猜你喜欢
    • 2018-01-18
    • 1970-01-01
    • 1970-01-01
    • 2012-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多