Jump to content

Echoing an HTML Tag...


natasha_thomas

Recommended Posts

Folks,

 

I want to echo an HTML tag in PHP.

 

<td width="300" bgcolor="#ffffff" align="center" onmouseout="style.backgroundColor='#ffffff'" onmouseover="style.backgroundColor='#e8e8e8';" style="word-wrap: break-word; border: 1px solid rgb(238, 238, 238); font-size: 12px; background-color: rgb(255, 255, 255);">

 

So what i am doing is;

 

echo '<td width="300" bgcolor="#ffffff" align="center" onmouseout="style.backgroundColor='#ffffff'" onmouseover="style.backgroundColor='#e8e8e8';" style="word-wrap: break-word; border: 1px solid rgb(238, 238, 238); font-size: 12px; background-color: rgb(255, 255, 255);">'; 

 

And its now working because this tag already has ' (Single Quotes) & ; (Semicolon)  so its conflicting.

 

Any work around for this friends?

 

Cheers

N

Link to comment
https://forums.phpfreaks.com/topic/237040-echoing-an-html-tag/
Share on other sites

put a backslash (\) before every quote

 

like this:

 

echo '<td width=\"300\" bgcolor=\"#ffffff\" align=\"center\" onmouseout=\"style.backgroundColor=\'#ffffff\'\" onmouseover=\"style.backgroundColor=\'#e8e8e8\';\" style=\"word-wrap: break-word; border: 1px solid rgb(238, 238, 238); font-size: 12px; background-color: rgb(255, 255, 255);\">\'; 

Link to comment
https://forums.phpfreaks.com/topic/237040-echoing-an-html-tag/#findComment-1218385
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.