Page 1 of 1

quotes within quotes within quotes oh my!

Posted: Wed Jan 12, 2005 1:49 pm
by PHPadvisor
I have the following:

Code: Select all

$mystring = "<img src='blah' onclick='document.forms&#1111;1].value += "<font size='2'></font>";'>";
Notice the 4th set of quotes: size='2'

that causes problems. Even escaping the quotes with a backslash doesn't help. My html gets messed up. Any ideas?

Posted: Wed Jan 12, 2005 2:06 pm
by jollyjumper
Does this help?

Code: Select all

$mystring =<<<EOHTML
<img src='blah' onclick='document.forms&#1111;1].value += "<font size="2"></font>";'>
EOHTML;
Greetz Jolly.

Posted: Wed Jan 12, 2005 2:46 pm
by feyd

Code: Select all

$mystring = "<img src='blah' onclick='document.forms&#1111;1].value += "<font size=&quote;2&quote;></font>";'>";
should work as well.