我的网站上有一个联系表,我希望它发送到我的contactform.php中,我必须将其发送到我的电子邮件中。我不知道为什么它不起作用。我填写了详细信息,然后单击“提交”,但没有任何反应。更具体地说,它将进入空白屏幕,并且没有任何内容发送到我的电子邮件中。
<h3 id="required">Contact Me</h3>
<form id="contactform" method="POST" action="scripts/contactform.php">
<label for="cname">Name</label>
<input type="text" id="cname" name="name" required>
<label for="cemail">Email</label>
<input type="email" id="cemail" name="email" required>
<label for="csubject">Subject</label>
<input type="text" id="csubject" name="subject" required>
<label for="cmessage">Message</label>
<textarea id="cmessage" name="message" required></textarea>
<input class="submit" type="submit" value="submit">
</form>
<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$mailFrom = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$mailTo = "database@terrytowell.com";
$headers = "From: ".$mailFrom;
$txt = "You have received an Email from ".$name.".\n\n".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: ../index.html");
}
?>