nats Posted March 2, 2009 Share Posted March 2, 2009 Can somebody plz tell me the Php code to display the HTML code snippet or any other language code which has been stored in the MySQL database & is retrieved on the browser without interpretation? My application includes a text box where the user gives an input of any text content which could also be an HTML code. This code is stored in the Database as it is by retaining the tags, but when I display it on the web page it interprets the code & shows the Output. Link to comment https://forums.phpfreaks.com/topic/147533-code-snippet/ Share on other sites More sharing options...
Lambneck Posted March 2, 2009 Share Posted March 2, 2009 Ive never tried it but doesn't wrapping <pre> tags around the code preserve it? Link to comment https://forums.phpfreaks.com/topic/147533-code-snippet/#findComment-774459 Share on other sites More sharing options...
niranjnn01 Posted March 2, 2009 Share Posted March 2, 2009 <?php $str = <<<A \$adsadad <br/> <div class="asdasdl"> <a class="link" href="example/example2/example"> Hello World </a> </div> A; echo "<pre>"; echo htmlentities($str); echo "</pre>"; ?> Link to comment https://forums.phpfreaks.com/topic/147533-code-snippet/#findComment-774473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.