[PHP] unexpected T_STRING error
Hi All, Can someone explain to me why I am getting an error for the following? $keywords = $_POST[keywords]; if ($keywords) { echolt;META NAME=keywords CONTENT= $keywords gt;; } TIA Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] unexpected T_STRING error
That line is syntactically invalid. Did you meant it to say echo lt;META NAME=$keywords CONTENT= $keywords gt;; -- JR -Original Message- From: Gary [mailto:[EMAIL PROTECTED]] Sent: Saturday, September 28, 2002 11:15 AM To: [EMAIL PROTECTED] Subject: [PHP] unexpected T_STRING error Hi All, Can someone explain to me why I am getting an error for the following? $keywords = $_POST[keywords]; if ($keywords) { echolt;META NAME=keywords CONTENT= $keywords gt;; } TIA Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unexpected T_STRING error
The quotes within the quotes. Change to: echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;; From: Gary [EMAIL PROTECTED] Sent: Saturday, September 28, 2002 11:15 AM Subject: [PHP] unexpected T_STRING error Hi All, Can someone explain to me why I am getting an error for the following? $keywords = $_POST[keywords]; if ($keywords) { echolt;META NAME=keywords CONTENT= $keywords gt;; } 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: echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unexpected T_STRING error
Everyone seems to forget that you don't have to do everything in PHP. if ($_POST[keywords]) { ?meta name=keywords content=? echo $_POST[keywords]; ?? } Happy hacking. Chris Gary wrote: Can someone explain to me why I am getting an error for the following? $keywords = $_POST[keywords]; if ($keywords) { echolt;META NAME=keywords CONTENT= $keywords gt;; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unexpected T_STRING error
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: echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;; From: Gary [EMAIL PROTECTED] Sent: Saturday, September 28, 2002 11:15 AM Subject: [PHP] unexpected T_STRING error Hi All, Can someone explain to me why I am getting an error for the following? $keywords = $_POST[keywords]; if ($keywords) { echolt;META NAME=keywords CONTENT= $keywords gt;; } 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: echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unexpected T_STRING error
You can mix and match single (') and double () quotes so the following are all appropriate: echo a 'string' b; echo a \string\ b; echo 'a \'string\' b; echo 'a string b; See? PHP can't read your mind and know what goes with what, like: echo abcdefg; // BAD Now, when dealing with arrays inside strings: echo an {$array['key']} b; echo 'an ' . $array['key'] . ' b'; echo an $array[key] b; See also: http://www.zend.com/zend/tut/using-strings.php http://www.php.net/manual/en/language.types.string.php Regards, Philip Olson On Sat, 28 Sep 2002, Gary wrote: Hi All, Can someone explain to me why I am getting an error for the following? $keywords = $_POST[keywords]; if ($keywords) { echolt;META NAME=keywords CONTENT= $keywords gt;; } TIA Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unexpected T_STRING error
I think you meant to end both of these strings with a ' Philip Olson wrote: echo 'a \'string\' b; echo 'a string b; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php