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. Quote Link to comment 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? Quote Link to comment 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>"; ?> 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.