0

当我单击表单页面上的提交按钮时,我收到消息:“解析错误:语法错误,意外的 T_STRING...在第 10 行”。我是 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);
?>
4

1 回答 1

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'];

我删除了一个额外的双引号。

于 2013-06-17T23:02:18.393 回答