quotes within quotes within quotes oh my!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PHPadvisor
Forum Newbie
Posts: 11
Joined: Mon Dec 13, 2004 3:20 pm

quotes within quotes within quotes oh my!

Post 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?
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply