我在我的网站联系表单遇到了问题!我已经尝试在网上寻找答案,但我是新手,如果可能的话,请给我一个简单的答案。我想编码某些地方出了问题,但我真的不知道是哪里出了问题!
问题 - 我按提交后收到电子邮件,但在我的收件箱中只显示主题行,不显示消息、电子邮件或发送者的姓名。
请帮帮我!
这是 HTML 代码:
请帮帮我!
这是 HTML 代码:
<form action="result.php" method="post">
<input name="Name" class="" type="text" value="Name (Required)" onfocus="if(this.value == 'Name (Required)') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Name (Required)'; }" />
<input name="Email" class="" type="text" value="Email (Required)" onfocus="if(this.value == 'Email (Required)') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Email (Required)'; }" />
<input name="Subject" class="" type="text" value="Subject" onfocus="if(this.value == 'Subject') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Subject'; }" />
<textarea name="Detail" cols="" rows="" onfocus="if(this.value == 'Describe your project in detail...') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Describe your project in detail...'; }">Describe your project in detail...</textarea>
<input type="submit" name="submit" action="submit" value="submit" class="submitbtn" />
<input type="reset" name="reset" action="reset" value="reset" class="resetbtn" />
</form>
以及 PHP 代码:
<?php
$name = $_POST['Name'];
$email = $_POST['Email'];
$subject = $_POST['Subject'];
$detail = $_POST['Detail'];
$to = "info@philippamichael.com";
$subject = "Contact Form Submission";
mail ($to, $subject, $detail, "From" . $name);
echo "Thank You. Your Message has been sent.";
?>
From
头部格式不正确。将"From" . $name
更改为"From: " . $email . "\r\n"
。 - War10ck