Re: Filtering out \ when a ' is user entered?
| From: | Stephen Cope | Date: | Thu, 28 Jun 2001 00:00:43 +0000 |
| Subject: | Re: Filtering out \ when a ' is user entered? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55435@lists.php.net to get a copy of this message | ||
Marcus James Christian said:
: \' How can I filter out these backslashes so they don't appear on the
: final public viewable page?
That's due to the magic_quotes variables in the PHP settings.
You can apply 'stripslashes()' to the string:
$what_they_said = stripslashes($what_they_said);
This also will convert \n to a new line, etc, in the string. If you don't
want that, and just want to rip any \ characters out (assuming your users
*never* enter a slash intentionally) then try:
$what_they_said = ereg_replace("\\", '', $what_they_said);
Turu.
--
Stephen Cope - http://sdc.org.nz/