PHP:'语法错误,意外的T_STRING'与mail()

时间:2012-08-10 08:39:19

标签: php forms html-email

我有一个只用PHP邮寄的简单脚本:

mail( "$webmaster_email", "RSVP from WC Entry Form",
   "From: $email, \n Name: $firstname $lastname \n 
   Phone Number: $phone \n 
   Address: $postal \n );
header( "Location: $thankyou_page" );

但我得到了Parse error: syntax error, unexpected T_STRING

我不确定这是什么谷歌没有给我任何明确的答案

有谁知道为什么会这样?

2 个答案:

答案 0 :(得分:3)

mail( "$webmaster_email", "RSVP from WC Entry Form",
   "From: $email, \n Name: $firstname $lastname \n 
   Phone Number: $phone \n 
   Address: $postal \n ");
header( "Location: $thankyou_page" );

你刚忘了'''。

答案 1 :(得分:2)

将代码更改为

mail( "$webmaster_email", "RSVP from WC Entry Form",
   "From: $email, \n Name: $firstname $lastname \n 
   Phone Number: $phone \n 
   Address: $postal \n ");
header( "Location: $thankyou_page" );