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); }}
<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>
你这是什么传法,没见过,连form表单都没有
你想用post传值怎么不告诉form表单了
print_r($_POST); 看看