Hi Dddogbruce,

@ 1:06:08 AM on 4/19/2001, Dddogbruce (@home.com) wrote:

> I'm having a problem with HTMLspecialchars and nl2br interfearing with
> each other.  Obviously, I'm trying to stop malicous HTML/scripts from
> being entered into my guestbook, but I'm also trying to add spacing.
> nl2br adds <br>, but HTMLspecialchars tells it to not show that.

Are you sure you wouldn't rather strip all HTML? I would do that then
implement my own special "tagged" language. A lot of developers go
with the [url]htp://www.example.com[/url] type of thing.

You can strip HTML with:

<http://www.php.net/manual/en/html/function.strip-tags.html>

> Anyways, I'm sure there is a way around this.  All help is welcome, so
> I'm eager for replys.  Thank you very, very much!

I wouldn't store <br>'s, or any HTML for that matter, in your database
unless there's just no other choice. If you do, you wind up having to
patch a lot of small problems -- like converting <br>'s back to
newlines if you were to quote original posts in a <textarea>, for
example. If you have <br>'s instead of the original newline
characters, then you run it through nl2br() again, you end up with
double the breaks.


-Brian
--
 PGP is spoken here: 0xE4D0C7C8
 Please, DO NOT carbon copy me on list replies.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to