这是给我提出问题的代码部分,它是向我的地址发送电子邮件,但不是从网站上的表格中填写的数据:
$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);
答案 0 :(得分:9)
您的字段被称为$nameField
等,您将它们作为$name
答案 1 :(得分:0)
检查字段名称,您会发现问题。 字段应为:
$nameField
$emailField
$phoneField
$commentField
不
$name
$email
$phone
$comment
答案 2 :(得分:0)
// 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>