当我单击带有表单的页面上的SUBMIT按钮时,我收到消息:“解析错误:语法错误,第10行意外T_STRING ...”。我是PHP的新手,无法弄清楚为什么它是错误的。任何帮助,将不胜感激。这是PHP代码:
<?php
$to="me@my.com";
$subject="Bits";
$message=
"Customer name: ". $_POST ['name']. "\r\n".
"Email: ". $_POST ['email']. "\r\n". "\r\n".
"Ordered Bits: ". $_POST [''] . "\r\n" .
$from="$_POST ['email'];
$headers = "From: $from". "\r\n";
$headers = "Bcc: me2@my.com" . "\r\n";
mail($to,$subject,$message,$headers);
?>
答案 0 :(得分:3)
$to = "me@my.com";
$subject = "Bits";
$message = "Customer name: ". $_POST ['name']. "\r\n" .
"Email: ". $_POST ['email']. "\r\n" . "\r\n".
"Ordered Bits: ". $_POST [''] . "\r\n" .
$from = $_POST['email'];
$headers = "From: " . $from . "\r\n";
$headers .= "Bcc: me2@my.com" . "\r\n";
mail($to, $subject, $message, $headers);
注意这一行:
$from = $_POST ['email'];
我删除了一个额外的双引号。