【发布时间】:2018-01-18 07:42:37
【问题描述】:
我刚开始使用 codeigniter 并遇到表单验证问题
这是我的代码 控制器:
public function indexnew(){
$data['title'] = array('welcome'=>'text here');
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->load->view('come/come',$data);
}
查看:
<form method="POST" action="form">
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<h5>Password</h5>
<input type="text" name="password" value="" size="50" />
<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" size="50" />
<h5>Email Address</h5>
<input type="text" name="email" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
添加了用户名验证,但它不起作用
请有人告诉我我做错了什么。
【问题讨论】:
-
给表单属性
action="controller_name/indexnew".
标签: php codeigniter validation