1
我的問題是,當我點擊提交form_validation-> run()的返回falseform_validation-> run()的返回false笨
這裏是我的控制器
public function change_pass()
{
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('new_pass', 'New Password', 'required|matches[cnew_pass]');
$this->form_validation->set_rules('cnew_pass','Confirm Password','required|matches[new_pass]');
if($this->form_validation->run()==FALSE)
{
die(print_r("Always go here"));
}
}
這是我的觀點... ..............
<?php echo form_open('tickets/change_pass'); ?>
<center>
<table>
<tr>
<td<label for="new_pass">New Password:</label>
<input type="password" name="new_pass" class="form-control"><?php echo form_error('new_pass');?>
</td>
</tr>
<tr>
<td<label for="cnew_pass">Confirm New Password:</label>
<input type="password" name="cnew_pass" class="form-control"><?php echo form_error('cnew_pass');?>
</td>
</tr>
</table>
<input type="submit" name="change" class="btn btn-success"> <input type="reset" class="btn btn-danger">
</center>
將您的完整代碼放在此處。 – user2936213
同樣在你的驗證規則中,只需刪除'matches [new_pass]'以確認密碼驗證 – user2936213
匹配[cnew_pass]就足夠了不需要匹配[new_pass] –