|
Posted by Nick Lazar on 03/21/06 15:19
Hi there,
I'm trying to set up a text to HTML filter on a form, for adding content to
a web page (of course).
I'm using htmlentities, but want to allow some HTML tags to be allowed in
the text, (<p>,<a>,<img> etc). I have tried including strip_tags with a list
of acceptable tags, but this doesn't seem to work well with htmlentities.
The code below gives an indication of what I am trying to do, and I know
there is a better way to do it! Any help would be gratefully accepted!
$paragraph = ($_POST['paragraph']);
$paragraph = nl2br(htmlentities($paragraph));
$paragraph = rtrim($paragraph);
$paragraph = ltrim($paragraph);
Regards,
Nick Lazar
Navigation:
[Reply to this message]
|