PHP表单不起作用 [英] PHP Form doesnt work

查看:375
本文介绍了PHP表单不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经将php脚本包含到了index.php中:

 <?php 
$ name = $ _POST ['name'];
$ email = $ _POST ['email'];
$ message = $ _POST ['message'];
$ from ='From:Andrewch';
$ to ='adreasch@gmail.com';
$ subject ='Hello';
$ human = $ _POST ['human'];

$ body =From:$ name\\\
电子邮件:$ email \\\
消息:\ $ $ message;

if($ _POST ['submit']&& $ human =='4'){
if(mail($ to,$ subject,$ body,$ from) ){
echo'< p>您的讯息已发送!< / p>';
} else {
echo'< p>出错了,请返回并重试!< / p>';

} else if($ _POST ['submit']&& $ human!='4'){
echo'< p>您回答了反垃圾邮件问题!错误< / p为H.';
}?>

而且html看起来像这样

 < form method =postaction => 

< label>名称< / label>
< input name =nameplaceholder =输入此处>

< label>电子邮件< / label>
< input name =emailtype =emailplaceholder =输入此处>

< label>讯息< / label>