I have a div which is editable, my users adds content into it and sometimes they adds html tags and saves into the database, now when I retrieve the text using php it is showing me the html tags rather then formatting it.
For example:
<div id='content' contentEditable='true'>
This is a html <a href='www.google.com' >formatted</a><strong>text</strong>
</div>
JavaScript, how I am posting:
var content = encodeURIComponent(document.getElementById('content').innerHTML);
{post content}
PHP, how I am displaying:
echo $_POST['content'];
It is displaying the link with proper default blue colored and underlined but the <strong>
and
<bold>
tags display as it is without the default HTML format.
This is how I am getting :
This is a html formatted
<strong>text<strong>
This is how I wanted to display:
This is a html formatted text