我对编码还很陌生,但是我的网站联系表存在问题。填写表格并单击提交按钮后,我将无法接收电子邮件。 我对PHP一无所知,很明显有些东西丢失或不正确。我只包含了文件的相关部分...感谢您能提供的任何帮助!
<div id="page_4">
<div id="wrapper">
<form action="contact form.php" method="post">
<label for="fname">Name</label>
<input type="text" name="name" placeholder="Full name...">
<label for="email">Email</label>
<input type="text" name="email" placeholder="...">
<label for="phone">Phone</label>
<input type="text" name="phone" placeholder="...">
<label for="subject">Subject</label>
<input type="text" name="subject" placeholder="...">
<label for="detail">Project Detail</label>
<textarea name="detail" placeholder="Please use detail if possible..." style="height:200px"></textarea>
<label for="deadline">Project Deadline (MO/DY/YR)</label>
<input type="text" name="deadline" placeholder="...">
<a href="mailto:mark@markabove.com"><input type="submit" value="Submit"></a>
</form>
</div>
</div>
<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$subject = $_POST['subject'];
$mailfrom = $_POST['mail'];
$message = $_POST['message'];
$mailTo = "mark@markabove.com";
$headers = "From: ".$mailFrom;
$txt = "You have recieved an e-mail from ".$name."\n\n".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: contact.html?mailsend");
}
?>
答案 0 :(得分:0)
表单操作标签的URL中有一个空格。也许将其更改为contact-form.php。