Re: Filtering out \ when a ' is user entered?
| From: | Richard Lynch | Date: | Wed, 27 Jun 2001 08:30:44 +0000 |
| Subject: | Re: Filtering out \ when a ' is user entered? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55342@lists.php.net to get a copy of this message | ||
> I'm pretty new to PHP but all I've seen of it so far I pretty much love!
>
> I've built a web log but when the user enters their data and they use '
> or " (and you know they will) php always shows it from the included
> web log as
>
> \' How can I filter out these backslashes so they don't appear on the
> final public viewable page?
You need those \ in there to store it into a database.
If you don't use a database, you can turn MagicQuotes off in php.ini
If you *do* use a database, you can use http://php.net/stripslashes to strip
out the slashes.
If, after turning off MagicQuotes, or calling stripslashes, you find you
need them back in there after all for something, you use http://addslashes
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm