0
我想讓我的聯繫表單工作,但是當我填寫表單時,它會拋出一個服務器沒有響應的錯誤。Bootstrap聯繫表格服務器沒有響應
你可以在這裏查看的jsfiddle:JS & HTML contact form code
的contact_me.php代碼:
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
// check if fields passed are empty
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
// create email body and send it
$to = '[email protected]'; // put your email
$email_subject = "Contact form submitted by: $name";
$email_body = "You have received a new message. \n\n".
" Here are the details:\n \nName: $name \n ".
"Email: $email_address\n Phone: $phone\n Message: \n $message";
$headers = "From: [email protected]\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>
我沒有看到任何代碼的任何錯誤,所以我不太清楚問題是。
嘗試在打開'<?php'標記後立即將錯誤報告添加到文件頂部 'error_reporting(E_ALL); ini_set('display_errors',1);'代替。 – 2014-12-03 01:11:46
另外,就我所見,您的表單沒有任何操作(表單默認爲自己省略時)並且沒有方法。表格默認爲GET時省略。 – 2014-12-03 01:13:55
@ Fred-ii-我已經將錯誤報告標記添加到了我的contact_me.php中,並且我還將action =「assets/contact_me.php」添加到了我的表單中..但仍然無法正常工作。 – Trisha 2014-12-03 01:27:24