Reputation: 1136
So I have a record in the database from a field named comments
.
Comment from <a href='www.google.com'># 12345</a><b>Hello</b>
but upon displaying in the browser, it's not being interpreted as HTML but as a plain text and displaying as is.
I'm expecting:
Comment from # 12345Hello
Code so far:
$comment = $adb->query_result($result,$i,'comments');
$comment = wordwrap($comment, 150, " ", true);
$comment = htmlentities($comment, ENT_QUOTES);
I've tried to comment out htmlentities
line but still displaying the same. Any idea how can I solve this?
Upvotes: 4
Views: 1167
Reputation: 3814
Try using html_entity_decode()
$comment = html_entity_decode($comment);
You can also try using htmlspecialchars_decode
$comment = htmlspecialchars_decode($comment);
Upvotes: 4