I am not sure what i am doing wrong and being just a starter in PHP i am not sure if my approach is correct or not. I am using TinyMCE Editor to store some text in database and will display this text in Browser in my WordPress powered site.
This is the text actually getting stored in database
<strong>Well we should think about how to see this editor</strong>
<ul>
<li>Its Good in nature</li>
<li>Well Matured</li>
<li>Easy to use.</li>
</ul>
<strong><span style=\"color: #ff0000;\">We should use this editor every now and than</span></strong> <span style=\"color: #333333;\">©</span>
This is going to be a heading to test it
<h1 style=\"text-align: right;\"></h1>
Sorry for such encoded text, i am using PHP's html_entity_decode method to send that text back to browser to get displayed.
This is my function call
html_entity_decode($event->Description,ENT_QUOTES,'UTF-8')
HTML Output
<font color="#cc0000">'<strong>Well we should think about how to see this editor</strong>
<ul>
<li>Its Good in nature</li>
<li>Well Matured</li>
<li>Easy to use.</li>
</ul>
<strong>
<span style=\"color: #ff0000;\">We should use this editor every now and than</span></strong>
<span style=\"color: #333333;\">©</span>
This is going to be a heading to test it
<h1 style=\"text-align: right;\"></h1>'</font>
Everything seems to be in place except the colors information.Colors are not working in the generated HTML output
Can anyone help me to understand where i am doing wrong seems like either i am not decoding it properly or some other thing i am missing which is sending wrong HTML from my php function call
esc_attr($_POST["data"])and than i am passing this data to the SQL query, i was doing decoding since without usinghtml_entity_decodemy data is being sent as string and HTML tags are not being parsed by browser properly