nl2br and strip_tags
Date: 02/13/08
(PHP Community) Keywords: php, yahoo
i'm still fairly new to php, so this questions may be pretty obvious.
i'm trying to allow strong, em, and a tags to pass through, but i also want to keep the breaks. all is fine with strong and em, but a's attributes show through. when i get rid of nl2br, everything works, but then i lose my breaks. here is my code:
$post = strip_tags($post, '');
$post = nl2br($post);
the link looks like this when it outputs:
href="http://www.yahoo.com">click here
a is missing, but the href shows through. link hovers, but of course, it doesn't take you anywhere.
thanks in advance!
Source: http://community.livejournal.com/php/612909.html