Try this:

$text = nl2br(htmlspecialchars(stripslashes($text)));

With $text being the data outputted. It will replace apostrophes, quotes,
etc. with their proper html formatting.

Example: input: "PHP is Cool!"
           html output: "PHP is Cool!"

Then if you don't want the $quot;, or whatever is outputted depending on the
input, you can write a script to strip them out if you like. There are lots
of things you can do from this point. Anyway, hope that helps you out...

Navid


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, August 25, 2001 2:49 PM
To: Sunil Jagarlamudi; [EMAIL PROTECTED]
Subject: [PHP] Re: escaping special charecters upon submit


> I have a form that submits data to a database, works great until
someome
> puts in an apostrophe in the comments area...how do i escape this
> charecter upon
> insert?





--
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]


-- 
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