[SOLVED] htmlspecialchars question
Posted: Tue Oct 05, 2004 10:49 am
I'm pulling text from a database. The text has some html in it. I need to translate special characters like "&" and "<" that might be in the text while allowing things like <b> and <a href> in the body copy. Originally I had coded it like this:
This doesn't work I get <b> <a href> printed to the screen. Is there a way to do this with out doing some sort of REGEX function to replace special chars?
Thanks
Code: Select all
<?php
print htmlspecialchars(nl2br($text));
?>Thanks