Hello
I have a php page with the following line:
<img src="face.gif" onmouseover="func('<?php print $name; ?>')">
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:
<img src="face.gif" onmouseover="func('Guy's name')">
What can I do?
thanks