php - How to stop HTML text in textarea to be interpreted as code -
i have textarea users can edit. after edit save text in php variable $bio. when want display this:
<?php $bio = nl2br($bio); echo $bio; ?>
but if user example types html command "strong" in text site output text bold. nothing want.
how can print/echo $bio on screen text , not html code?
thanks in advance!
replace echo $bio;
echo htmlspecialchars($bio);
Comments
Post a Comment