I'm having an issue with some HTML that I'm decoding and then displaying.
I post data from a WYSIWYG text editor called TinyMCE and store it into a database using the following code (with unrelated code not included)
$text = $_POST['bbcode_field']; // from textarea
if(get_magic_quotes_gpc()){
$text = stripslashes($text);
//strip off the slashes if they are magically added.
}
$text = htmlentities($text);
I then enter the data into the database using the following
Report ='".htmlspecialchars(mysql_real_escape_string($text), ENT_QUOTES)."',
Which is great, it inserts into the database perfectly fine. When I then try to retrieve the data from the database and decode it using
'.html_entity_decode($row['Content']).'
and echo it out, it's echoes it out but includes the HTML formatting such as <p>
tags etc.
I need to be displayed on the HTML page but using the formatting of the HTML tags.
Where have I gone wrong here?
Thanks.