[英]My php form is sending the email but not the data
這是給我問題的代碼部分,它是向我的地址發送電子郵件,而不是從網站以表格形式填寫的數據:
$emailSubject = 'Website Enquiry';
$webMaster = 'cynthiab1984@gmail.com';
/*Gathering Data Variables*/
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$phoneField = $_POST['phone'];
$commentField = $_POST['comment'];
$body = <<<EOD
<br><hr><br>
name: $name<br>
email: $email<br>
phone number: $phone<br>
comment: $comment<br>
EOD;
$headers = "From:$email\r\n";
$headers .= "Content-type:text/html\r\n";
$success = mail ($webMaster, $emailSubject, $body, $headers);
您的字段稱為$nameField
等,並將它們作為$name
放在電子郵件正文中
檢查您的字段名稱,您將發現問題。 字段應為:
$nameField
$emailField
$phoneField
$commentField
不:
$name
$email
$phone
$comment
// Edits made below
// This is your area to edit
$body = <<<EOD
<br><hr><br>
name: $nameField<br>
email: $emailField<br>
phone number: $phoneField<br>
comment: $commentField<br>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.