php有关于textarea联入数据库的问题——求助
页面部分:<divclass="col-md-8contact-left"><formclass="contact-details"method="POST"action...
页面部分:<div class="col-md-8 contact-left"> <form class="contact-details" method="POST" action="back.php?action=contact"> <input type="text" class="text" name="name" id="nam" value="Your Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your Name';}"> <input type="text" class="text" name="mail" id="mail" value="Your mail" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your mail';}"> <input type="text" class="text" name="sub" id="sub" value="Subject" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Subject';}"> <textarea type="textarea" class="text" name="mes" id="mes" onfocus="if(this.value == 'Message') this.value='';" onblur="if(this.value == '') this.value='Message';" >Message</textarea> <div class="clearfix"></div> <input type="submit" value="SEND MESSAGE"> </form> </div>方法部分://function for contact.php case 'contact': $nam = isset($_POST['nam']) ? $_POST['nam'] : ""; $mail = isset($_POST['mail']) ? $_POST['mail'] : ""; $sub = isset($_POST['sub']) ? $_POST['sub'] : ""; $mes = isset($_POST['mes']) ? $_POST['mes'] : ""; if(!empty($nam)&&!empty($mail)&&!empty($sub)&&!empty($mes)) { $sql = "INSERT INTO `contact`(nam, mail, sub, mes) VALUES ('$nam','$mail','$sub','$mes')"; mysql_query($sql, $db); echo "<script>alert('您的Message已送到!');history.back();</script>"; } else { echo "<script>alert('请输入完整数据!');history.back();</script>"; } break;无论我是不是数据完整都提示“请输入完整数据”,why?
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询