|
本帖最后由 naodai 于 2009-8-3 22:11 编辑
按照例子上写的,
但却说这个函数为定义,
怎么弄啊!
controller代码:
<?php
class Form extends Controller {
function Form() {
parent::Controller();
$this->load->helper(array('form', 'url'));
$this->load->library('validation');
}
function index()
{
if ($this->validation->run() == FALSE)
{
$this->load->view('valid');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>
view代码:
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo validation_errors(); ?>
<?php echo form_open('form'); ?>
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<h5>assword</h5>
<input type="text" name="password" value="" size="50" />
<h5>assword 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>
</body>
</html>
另外,表单验证类是不是改名了啊,
我按照例子上的$this->load->library('form_validation');不行啊,
改成$this->load->library('validation');这样就行了.
菜鸟才开始,见笑了,请各位大虾多多指教!谢谢! |
|