2015-09-06 64 views
0

我想用下面的HTML和PHP給我的聯繫表格加電,當我輸入信息並按回車鍵時,我總是得到一個錯誤!用php提供聯繫表格

HTML

<form action="contact.php" method="POST"> 
    <input type="text" placeholder="your name" name="name"> 
    <input type="email" placeholder="Your Email" name="email"> 
    <textarea placeholder="Your Message" name="message"></textarea> 
    <button type="submit">submit</button> 
</form> 

PHP

<?php 
    $name = $_POST['name']; 
    $email = $_POST['email']; 
    $message = $_POST['message']; 
    $formcontent=" From: $name \n Email: $email \n Message: $message"; 
    $recipient = "[email protected]"; 
    $subject = "Contact Form"; 
    $mailheader = "From: $email \r\n"; 
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); 
    echo "Thank You!"; 
?> 

我已經上傳我的服務器上的這些文件,你可以檢查它here

+1

您能否讓我們知道您面臨的錯誤? – 2015-09-06 06:27:18

+0

我正在使用此PHP來爲我的聯繫表單提供電源,並且當我將其上載到我的服務器時,我沒有收到任何電子郵件,而是收到錯誤消息!總是。 –

+0

我能猜到嗎?你在輸入中使用了撇號(''')嗎? –

回答

0

我沒有看到任何錯誤你的代碼。可能您的主機可能禁用了郵件()功能

+0

我將如何啓用該功能? –