html entities
Posted: Sun Mar 26, 2006 7:22 pm
I have a database field that may or may not contain html
One instance may be
and another instance may be
My problem comes when displaying these in a textarea field. Obviously I want to show the html as text, so in both cases the html should show up as
I'm not sure how to do this, but I was thinking something along these lines
Is there any case where this would mess up? For instance if the user wrote out an entity as text like " but the message was stored in HTML.
Would this still show up fine?
I can't seem to wrap my mind around the idea.
One instance may be
Code: Select all
<a href="#">link here</a>Code: Select all
<a href="#">link here</a>Code: Select all
<a href="#">link here</a>Code: Select all
$text = htmlentities(html_entity_decode($databasetext,ENT_QUOTES),ENT_QUOTES);
echo "<textarea>$text</textarea>";Would this still show up fine?
I can't seem to wrap my mind around the idea.