|
controller/center/register.php
----------------------------------------------------------------
class Register extends Controller{
function index(){
$this->load->helper(array('form','url'));
$this->load->library('validation');
$rules['username'] = "required";
$rules['password'] = "required";
$rules['repassword'] = "required";
$rules['email'] = "required";
$rules['idcard'] = "required";
$rules['autocode'] = "required";
$this->validation->set_rules($rules);
if ($this->validation->run() == false){
$this->load->view('center/v_register');
}else{
$this->load->view('center/v_register_secussful');
}
}
}
-------------------------------------------------------
view/center/v_register.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><? //=$title."--".$link;?></title>
</head>
<body>
<?=$this->validation->error_string;?>
<?=form_open('center/register'); ?>
<label for="username">帐号:</label>
<input type="text" name="username" id="username" class="" maxlength="20" /><br />
<label for="password">密码:</label>
<input type="password" name="password" id="password" class="" maxlength="32" /><br />
<label for="password">确认密码:</label>
<input type="password" name="repassword" id="repassword" class="" maxlength="32" /><br />
<label for="email">Email:</label>
<input type="text" name="email" id="email" class="" maxlength="32" /><br />
<label for="idcard">身份证号码:</label>
<input type="text" name="idcard" id="idcard" class="" maxlength="18" /><br />
<label for="autocode">验证码:</label>
<input name="autocode" type="text" class="" id="autocode" size="5" maxlength="5" />
<br />
<input name="ipaddress" type="hidden" class="" id="ipaddress" value="<?=$_SERVER['REMOTE_ADDR'];?>" />
<input name="register_time" type="hidden" class="" id="register_time" value="<?=date('Y-m-d H:i:s',time());?>" />
<input name="" type="button" value="提交" />
<?=form_close();?>
</body>
</html>
以上有什么问题?请指教。 |
|