escaping characters...
Posted: Tue Jun 22, 2004 7:37 am
Hello
I have a php page with the following line:
I am using double quotes to enclose the onmouseover value.
I am using single quotes around the name because the func function expects a string.
The problem is that the $name variable may also contain quotes (single or double), and that causes the generated javascript code to misbehave.
I tried using htmlspecialchars & htmlentities but, I am still getting generated code like so:
What can I do?
thanks
I have a php page with the following line:
Code: Select all
<img src="face.gif" onmouseover="func('<?php print $name; ?>')">I am using single quotes around the name because the func function expects a string.
The problem is that the $name variable may also contain quotes (single or double), and that causes the generated javascript code to misbehave.
I tried using htmlspecialchars & htmlentities but, I am still getting generated code like so:
Code: Select all
<img src="face.gif" onmouseover="func('Guy's name')">thanks