PHP联系表单未提交

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

这是表格的html:

<div id="formContainer">

    <form action="form.PHP" method="post" id="contactForm"> 
    <fieldset>

    <legend>Your details</legend>    

    <label for="name">Name *</label>
    <input type="text" id="name">

    <label for="email">Email *</label>
    <input type="email" id="email">

    <label for="tel">Telephone</label>
    <input type="tel" id="tel">

    </fieldset>

    <fieldset> 
    <legend>Tutoring</legend>

    <label for="type">Type of lesson</label>
    <select name="type" id="type">
    <option>Individual</option>
    <option>Group</option>
    </select>

    <label for="subject">Subject</label>
    <input name="subject" list="subjects" id="subject">
    <datalist id="subjects">
    <option>English</option>
    <option>Biology</option>
    <option>Geography</option>
    </datalist>

    <label for="level">Your level</label>
    <select name="level" id="level">
    <option>Beginner</option>
    <option>GCSE</option>
    <option>A-Level</option>
    <option>University</option>
    </select>

    <label for="hours">Hours/week</label>
    <input type="number" id="hours">

    <label for="info">Additional information</label>
    <textarea name="info" id="info" rows="10"               cols="6"></textarea>


    </fieldset>

    <input type="submit" name="submit" value="Send" id="sendButton">

    <input type="hidden" name="submit_check" value="1" />   
    </form>

    </div>

这是简单的PHP脚本:

<?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"]."<br>"; 
    $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; 
    $MESSAGE_BODY = "Telephone: ".$_POST["tel"]."<br>";
    $MESSAGE_BODY = "Type: ".$_POST["type"]."<br>";
    $MESSAGE_BODY = "Subject: ".$_POST["subject"]."<br>";
    $MESSAGE_BODY = "Level: ".$_POST["level"]."<br>";
    $MESSAGE_BODY = "Hours required: ".$_POST["hours"]."<br>";
    $MESSAGE_BODY .= "Additional information: ".nl2br($_POST["info"])."<br>"; 
    mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 

?> 

<html>

    <h3>Thanks for your email</h3>
    <h4>I'll get back to you as soon as possible</h4>
    <a href="index.html"><p>Click here to go back to prevIoUs page</p></a>

</html>


<?PHP 
} else { 
?> 

<html>Sorry, this form didn't work</html>

<?PHP 
}; 
?>

解决方法:

试试看

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

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

echo '<pre>';
var_dump( $_POST );

相关文章

HTML5和CSS3实现3D展示商品信息的代码
利用HTML5中的Canvas绘制笑脸的代码
Html5剪切板功能的实现
如何通过HTML5触摸事件实现移动端简易进度条
Html5移动端获奖无缝滚动动画实现
关于HTML5和CSS3实现机器猫的代码