|
Posted by Ken on 02/05/06 06:06
Thanks so much for the detailed explanation!
Paul Haxter wrote:
> What you are describing is an issue that all php newbies face.
>
> It is caused by a setting in the PHP configuration file called
> magic_quotes_gpc. If this is turned on (which it is by default), all '
> (single-quotes), " (double quotes), and \ (backslashs) are escaped with
> a backslash automatically in the GET, POST, and COOKIE globals.
>
> Many databases (MySQL for example) and other systems need escape
> characters to handle such characters. PHP automatically adds these
> slashes so you don't have to when you want to use the data in other
> systems. Isn't that nice of PHP? Many people, including myself, say
> NO! But it does.
>
> You have two options:
>
> 1. Change the PHP configuration of magic_quotes_gpc to off.
>
> 2. Use the stripslashes() function to remove the escape slashes from
> the posted variables. I strongly suggest that you use this method
> because if you simply change the configuration, your script would not
> work right on other systems not properly configured.
>
[Back to original message]
|