我與我的網站上的聯繫表格有問題! 我試過網上搜索的答案,但我是新來這個網站建設,並會欣賞一個簡單的答案,如果可能的話。我猜編碼是錯的,但我真的不知道在哪裏!網站聯繫表格提交空白電子郵件
問題 - 我收到的電子郵件按提交之後,但在我的收件箱它只顯示主題行和不顯示的消息,電子郵件或者從它的人的名字。
請幫忙!
下面是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 = "[email protected]";
$subject = "Contact Form Submission";
mail ($to, $subject, $detail, "From" . $name);
echo "Thank You. Your Message has been sent.";
?>
'var_dump($ _ POST);' – user1947561
我認爲你的'From'標題格式不正確。改變'「來自」。 $ name'到'「From:」。 $電子郵件。 「\ r \ n」'... – War10ck