Re: unexpected T_STRING error
| From: | Gary | Date: | Sat, 28 Sep 2002 15:38:07 +0000 |
| Subject: | Re: unexpected T_STRING error | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117957@lists.php.net to get a copy of this message | ||
I knew I shouldn't of been doing this on Saturday morning. I forgot something as simple as that. Maybe another jolt of caffeine is needed.
Thanks
Gary
Matt wrote:
The quotes within the quotes. Change to: echo"<META NAME=\"keywords\" CONTENT=\" $keywords \">";From: "Gary" <garyb10@earthlink.net> Sent: Saturday, September 28, 2002 11:15 AM Subject: [PHP] unexpected T_STRING errorHi All, Can someone explain to me why I am getting an error for the following? $keywords = $_POST[keywords]; if ($keywords) { echo"<META NAME="keywords" CONTENT=" $keywords ">"; }The quotes within the quotes -- you need to escape them. Otherwise, the second double quote terminates the quoted string, yet there's some more junk on the line. By escaping them, you tellphp you mean the literal ", and don't want to terminate the string . So change to: echo"<META NAME=\"keywords\" CONTENT=\" $keywords \">";