hlstriker Posted October 23, 2006 Share Posted October 23, 2006 Hi, I am trying to add html to a php variable so it can then send the HTML code to a field in my database. (Yes I want the html code itself to be sent to the database!)I get "unexpected T_STRING" error for this code...[code]$html = "<tr> <td valign='top' align='center' bgcolor='#212121'> <a href='#' onmouseover="roll_over('name', 'http://www.mysite.com/image-hover.jpg')" onmouseout="roll_over('name', 'http://www.mysite.com/image.jpg')"> <img border='0' src='http://www.mysite.com/image.jpg' name='name'></a> </td></tr>"[/code]The error line is where I start the link. I think it is because of the double quotes, but I don't know how to bypass this because if I put the single quotes in the link, the javascript won't function.If someone could tell me how to do this please do! Thanks! Quote Link to comment Share on other sites More sharing options...
fert Posted October 23, 2006 Share Posted October 23, 2006 use \" Quote Link to comment Share on other sites More sharing options...
fiddy Posted October 23, 2006 Share Posted October 23, 2006 Hi,You are getting this error because you use just ", you should use \" becuse you have started with ".i feel its better to do like this.So that you can add HTML as you wish without worrying about the quotes and double quotes$html = <<START<tr> <td valign='top' align='center' bgcolor='#212121'> <a href='#' onmouseover="roll_over('name', 'http://www.mysite.com/image-hover.jpg')" onmouseout="roll_over('name', 'http://www.mysite.com/image.jpg')"> <img border='0' src='http://www.mysite.com/image.jpg' name='name'></a> </td></tr>START; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.