php联系人表单,PHP联系表单未提交

嗨,我以前曾经成功地使用过这个非常简单的php联系人脚本,但是当我尝试在新HTML页面上实现该表单时,它不会提交.谁能看到任何明显的错误?

任何帮助将非常感激

这是表格的html:

Your details

Name *

Email *

Telephone

Tutoring

Type of lesson

Individual

Group

Subject

English

Biology

Geography

Your level

Beginner

GCSE

A-Level

University

Hours/week

Additional Information

这是简单的php脚本:

if ($_POST["email"]<>'') {

$ToEmail = 'onjegolders@gmail.com';

$EmailSubject = 'Site contact form ';

$mailheader = "From: ".$_POST["email"]."\r\n";

$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";

$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";

$MESSAGE_BODY = "Name: ".$_POST["name"]."
";

$MESSAGE_BODY .= "Email: ".$_POST["email"]."
";

$MESSAGE_BODY = "Telephone: ".$_POST["tel"]."
";

$MESSAGE_BODY = "Type: ".$_POST["type"]."
";

$MESSAGE_BODY = "Subject: ".$_POST["subject"]."
";

$MESSAGE_BODY = "Level: ".$_POST["level"]."
";

$MESSAGE_BODY = "Hours required: ".$_POST["hours"]."
";

$MESSAGE_BODY .= "Additional information: ".nl2br($_POST["info"])."
";

mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");

?>

Thanks for your email

I'll get back to you as soon as possible

Click here to go back to previous page

} else {

?>

Sorry, this form didn't work

};

?>

解决方法:

试试看

if ( !empty($_POST["email"]) )

但是,您可以使用以下方法检查该页面上发布的内容:

echo '

';

var_dump( $_POST );

标签:contact-form,html5,php

来源: https://codeday.me/bug/20191102/1993525.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值