问题是这样的,thinkphp我的添加类只能添加进name,salary,grade,email,本人小白希望大神们不要嫌弃,
这是添加页HTML代码
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加新闻信息</title>
</head>
<style type="text/css">
.input,img{vertical-align:middle;}
</style>
<body>
<form name="form1" method="post" action="__URL__/add">
<table width="643" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="center">添加新闻信息</td>
</tr>
<tr>
<td width="154" height="26" align="right">名字:</td>
<td width="489" height="26"><input name="name" type="text" id="name" ></td>
</tr>
<tr>
<td height="26" align="right">级别:</td>
<td height="26"><input name="grade" type="text" id="grade"></td>
</tr>
<tr>
<td height="26" align="right">性别:</td>
<td height="26"><input name="sex" type="text" id="sex"></td>
</tr>
<tr>
<td height="26" align="right">年龄:</td>
<td height="26"><input name="old" type="text" id="old"></td>
</tr>
<tr>
<td height="26" align="right">薪水:</td>
<td height="26"><input name="salary" type="text" id="salary"></td>
</tr>
<tr>
<td height="26" align="right">教育:</td>
<td height="26"><input name="edu" type="text" id="education"></td>
</tr>
<tr>
<td height="26" align="right">兴趣:</td>
<td height="26"><input name="hobby" type="text" id="hobby"></td>
</tr>
<tr>
<td height="26" align="right">email:</td>
<td height="26"><textarea name="email" cols="60" rows="8" id="email"></textarea></td>
</tr>
<tr>
<td height="26" align="right"> </td>
<td height="26"><input type="submit" name="Submit" value="添加信息">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</body>
</html>
这是添加类代码
public function add()
{
$insert = D('emp');
if(!empty($_POST)){
$z=$insert->add($_POST);
if($z){
$this->redirect('ok');
}
}else {
$this->display();
}
一瞬儿光
一句话儿的事