Re: Encoding Ampersands
| From: | Rick Dwyer | Date: | Thu, 29 Jul 2010 04:29:37 +0000 |
| Subject: | Re: Encoding Ampersands | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-307192@lists.php.net to get a copy of this message | ||
So htmlentities() will work for "Green, Red & Blue"?
Will it work for "....htm?color=blue&number=2&letter=...."?
--Rick
On Jul 29, 2010, at 12:23 AM, Josh Kehn wrote:
> Rick-
>
> Probably would use htmlentities() instead. You could also do str_replace("&",
> "&");
>
> Regards,
>
> -Josh
>
> On Jul 29, 2010, at 12:18 AM, Rick Dwyer wrote:
>
>> Hello List.
>>
>> I have variables displaying content from mysql fields. The contents contains & like
>> "Dogs & Cats"... so naturally the W3C validator chokes on them.
>>
>> Is there a way to encode so they display properly on the page but the validator is OK with
>> them?
>>
>>
>> Is the answer as simple as:
>>
>> urlencode($myvar)
>>
>> Thanks,
>> --Rick
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>