rockinaway Posted May 25, 2007 Share Posted May 25, 2007 I have a piece of text which is entered into my database, this text contains HTML. When I output it onto the page I want the HTML to turn into HTML and do what it is supposed to do, instead of just being normal text. How would I do this? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted May 25, 2007 Share Posted May 25, 2007 If you have HTML within the database then it should be treated as HTML when it is outputted to the browser. However if your HTML is not being parsed by the browser then it seems that you are storing the HTML entity version of the HTML tags, for example rather than storing this: <b>Hello world</b> You are actually storing this: <b>Hello World</b> And so when you output it to the browser you see the HTML code. Try using html_entity_decode when you output your HTML. Does it make a difference? Quote Link to comment Share on other sites More sharing options...
rockinaway Posted May 25, 2007 Author Share Posted May 25, 2007 html_entity_decode works wonders .. Thanks! Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted May 25, 2007 Share Posted May 25, 2007 In that case your HTML is being escaped (converted in to its HTML equivalent) when you store it in the database. 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.