Home > Backend Development > PHP Tutorial > 数据库传不进去!

数据库传不进去!

WBOY
Release: 2016-06-20 12:32:19
Original
1005 people have browsed it

function sendMsg() {	global $messageReturn,$WEB_dbprefix;	$userName=trim($_POST['username']);	$userName1=trim($_POST['username1']);	$msgContent=checkhtml(trim($_POST['msgcontent']));	$dtime=date("Y-m-d H:i:s");		if($userName=='' || $userName==null) {		$messageReturn[1]="姓名不能为空";		error($messageReturn);	}		if($userName1=='' || $userName1==null) {		$messageReturn[1]="姓名不能为空";		error($messageReturn);	}	if($msgContent=='' || $msgContent==null){		$messageReturn[1]="内容不能为空";		error($messageReturn);	}		$sql="insert into {$WEB_dbprefix}message(UserName,UserName1,MsgContent,DateTime) values('$userName','$userName1','$msgContent','$dtime')";	$result = conn_Db() -> query($sql);	if($result==true){		$messageReturn[0]=1;		$messageReturn[1]="留言成功";		error($messageReturn);	}else{		$messageReturn[1]="留言失败";		error($messageReturn);	}}
Copy after login


	<table border="0" cellpadding="2" cellspacing="1">			<tr>				<td width="60px"><label for="username">姓名(*):</label></td>				<td><input type="text" name="username" id="username" value="" /></td>			</tr>			<tr>				<td width="60px"><label for="username1">姓名1(*):</label></td>				<td><input type="text" name="username1" id="username1" value="" /></td>			</tr>			<tr>				<td width="80px"><label for="content">内容(*):</label></td>				<td><textarea name="msgcontent" id="msgcontent"></textarea></td>			</tr>			<tr>				<td width="60px"></td>				<td><input name="Submit" type="button" class="bt" id="bt_send" value="提交留言" onclick="return chkForm();" /><span id="sending"></span></td>			</tr>			</table>
Copy after login

username1为什么传不进去 总是提示为空


回复讨论(解决方案)

你这是什么传法,没见过,连form表单都没有

  • 蓝色
  • 绿色
  • 红色
  • 黄色
欢迎, 修改密码 注销 发表留言
<table border="0" cellpadding="2" cellspacing="1"> <tr> <td width="60px"><label for="username">姓名(*):</label></td> <td><input type="text" name="username" id="username" value="" /></td> </tr> <tr> <td width="60px"><label for="username1">姓名1(*):</label></td> <td><input type="text" name="username1" id="username1" value="" /></td> </tr> <tr> <td width="80px"><label for="content">内容(*):</label></td> <td><textarea name="msgcontent" id="msgcontent"></textarea></td> </tr> <tr> <td width="60px"></td> <td><input name="Submit" type="button" class="bt" id="bt_send" value="提交留言" onclick="return chkForm();" /><span id="sending"></span></td> </tr> </table>
Copy after login

你想用post传值怎么不告诉form表单了

print_r($_POST); 看看

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template