shane07 Posted April 9, 2008 Share Posted April 9, 2008 Hi My problem arises with the htmlspecialchars() function. I used this function to store the html data into the database because without this function I could not insert the html data. But when I try to retrieve this data php renders in the form of "<table><tbody>". which I do not want. I actually want the 'table' instead of the '<table>'. What should I do to avoid this? Thanx Link to comment https://forums.phpfreaks.com/topic/100339-how-to-render-htmlspecialchar/ Share on other sites More sharing options...
Caesar Posted April 9, 2008 Share Posted April 9, 2008 <?php //Reverse the effect htmlsepcialchars() on a string you return from your database ($str) $html = htmlspecialchars_decode($str); ?> Link to comment https://forums.phpfreaks.com/topic/100339-how-to-render-htmlspecialchar/#findComment-513060 Share on other sites More sharing options...
effigy Posted April 9, 2008 Share Posted April 9, 2008 You shouldn't need this at all. Are you passing the data through the proper database escaping functions? Link to comment https://forums.phpfreaks.com/topic/100339-how-to-render-htmlspecialchar/#findComment-513066 Share on other sites More sharing options...
shane07 Posted April 9, 2008 Author Share Posted April 9, 2008 You shouldn't need this at all. Are you passing the data through the proper database escaping functions? Yes I understand what this means. But the data contains a lot of double quotes and single quotes. Are you indicating the use of addslashes() function? Link to comment https://forums.phpfreaks.com/topic/100339-how-to-render-htmlspecialchar/#findComment-513083 Share on other sites More sharing options...
shane07 Posted April 9, 2008 Author Share Posted April 9, 2008 Yes that worked too Thank You Link to comment https://forums.phpfreaks.com/topic/100339-how-to-render-htmlspecialchar/#findComment-513087 Share on other sites More sharing options...
effigy Posted April 9, 2008 Share Posted April 9, 2008 Are you indicating the use of addslashes() function? No. mysql_real_escape_string if you're using MySQL. Link to comment https://forums.phpfreaks.com/topic/100339-how-to-render-htmlspecialchar/#findComment-513091 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.