我的 HTML5 表单验证得很好,但是我想在提交时发送数据输入。我遵循了一些教程,并且一个基本教程有效,但是我现在尝试了一个更复杂的 PHP 脚本来发送电子邮件,但我没有收到任何东西??
<?php
// Subject and Email Variables
$emailSubject = 'HTML5 Form Submission';
$webMaster = 'John.Doe@live.co.uk';
//Gathering Data variables
$FNameField = $_POST['FName'];
$LNameField = $_POST['LName'];
$ageField = $_POST['age'];
$emailField = $_POST['EMail'];
$URLField = $_POST['URL'];
$telField = $_POST['tel'];
$messageField = $_POST['message'];
$body = <<<EOD
<br><hr><br>
Name: $FNameField<br>
Age: $ageField <br>
Email: $emailField <br>
Website: $URLField <br>
Telephone: $telField <br>
Message: $messageField <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
$theResults = <<<EOD
<html>
<head>
<title>JakesWorks - travel made easy-Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>
<div>
<div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
<div>
<a href="Forms.php">Click Here to return to the previous page</a>
</body>
</html>
EOD;
echo "$theResults";
?>
编辑:它也是网络托管的,所以那里没有问题,我的服务器确实理解 PHP