kyushudan Posted February 8, 2009 Share Posted February 8, 2009 This text(HTML) resides in a field in a MYSQL dbase: <img src="map_pix/Akashi.jpg" width="200px" height="100px" alt="Akashi Castle"> I fetch it then echo it thus: echo $row['image']. "<br />"; The rendered HTML (as it appears in Firefox 3.0): <img src="map_pix/Akashi.jpg" width="200px" height="100px" alt="Akashi Castle"> I check the source, it reads: <img src="map_pix/Akashi.jpg" width="200px" height="100px" alt="Akashi Castle"> I can see why but How do I make it executable code? ??? ? Even more confusing is that: <img src="map_pix/Akashi.jpg" width="200px" height="100px" alt="Akashi Castle"> works fine when convert the MYSQL contents into an XML file that is read by a google map. But hey, that's not the problem. Apologies if I've posted in the wrong place; php? mysql? html? wasn't sure Quote Link to comment Share on other sites More sharing options...
gevans Posted February 8, 2009 Share Posted February 8, 2009 It looks like you#re using htmlspecialchars() before adding to the database, you can reverse this using htmlspecialchars_decode() htmlspecialchars_decode Quote Link to comment Share on other sites More sharing options...
kyushudan Posted February 8, 2009 Author Share Posted February 8, 2009 Thank you - A lot!! This did it: echo html_entity_decode($row['image']). "<br />"; Quote Link to comment Share on other sites More sharing options...
gevans Posted February 8, 2009 Share Posted February 8, 2009 Just remember if users are adding this they can add any html content to your page, as well as javascript 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.