RE: [PHP] Re: escaping special characters upon submit

From: Date: Sun, 26 Aug 2001 05:55:10 +0000
Subject: RE: [PHP] Re: escaping special characters upon submit
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64478@lists.php.net to get a copy of this message
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: idesign@tampabay.rr.com [mailto:idesign@tampabay.rr.com] Sent: Saturday, August 25, 2001 2:49 PM To: Sunil Jagarlamudi; php-general@lists.php.net 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#64478) next »