PHP string parse error with necessary semicolon after variable

In my PHP code I have a variable $message which includes the message to be sent to me which has post variables in it. It is supposed to have a semicolon at the end...but it gives me an error saying it is unexpected but I know I need it because it wont work without it. I am at a complete loss. Hopefully someone here can help me.

Error Message:

PHP Parse error:  syntax error, unexpected ';'

PHP Code

if(!empty($_POST["name"]) && !empty($_POST["address"]) && !empty($_POST["city"]) && !empty($_POST["phone"]) && !empty($_POST["email"]) && !empty($_POST["type"]))
{
$message = "Name:" . $_POST["name"] . 
"Address:" . $_POST["address"] . 
"City:" . $_POST["city"] . 
"State:" . $_POST["state"] . 
"Zip Code:" . $_POST["zip"] . 
"Phone:" . $_POST["phone"] . 
"Email:" . $_POST["email"] . 
"Current Roof Type:" . $_POST["type"] . 
"Roof Age:" . $_POST["age"] .
"Is it leaking?:" . $_POST["leak"] . 
"Does it have hail damage?:" . $_POST["hail"] . 
"Insurance:" . $_POST["insurance"] . 
"Additional Comments:" . $_POST["extra"] . 
;                                          <---------------####Unexpected semicolon
$to = "emailasdasdasdasd";
$subject = "Free Estimate";
$from = "Guarantee Roofing";
$headers = "From:" . $_POST["name"];
mail($to,$subject,$message,$headers);
}

here is the problem

 "Additional Comments:" . $_POST["extra"] . 
 ;

should be

  "Additional Comments:" . $_POST["extra"]   ;

"Additional Comments:" . $_POST["extra"] .  
                                         ^

Unnecessary concatenation operator -----------------here.

PHP is expecting a string/variable next to the concatenation operator and finds semicolon, which is reported unexpected .


"Additional Comments:" . $_POST["extra"] . 
                                         ^---- dangling concatenation
;  

你告诉PHP连接一对字符串,然后终止语句而不提供第二个字符串。

链接地址: http://www.djcxy.com/p/11940.html

上一篇: 解析错误意外“:”在localhost中正常工作

下一篇: PHP字符串在变量之后用必要的分号解析错误