Posted by Rik on 07/04/06 20:01
FP wrote:
> Not sure if this post belogs here, but I'm hoping someone can help me
> out.
> I can get the contents of the my database comments field using PHP.
> The comments field may include single or double quotes or other
> strange characters.
> How do I compensate for these problem characters when I try to set a
> JavaScript variable? eg.
>
> <SCRIPT LANGUAGE="JavaScript">
> MyComments = " <? PHP result here?>"
> </script>
addslashes()
Or maybe htmlentities() is a better choice here.
Grtz,
--
Rik Wasmus
[Back to original message]
|