Re: Newbie problem - Slashes
| From: | 1LT John W. Holmes | Date: | Thu, 27 Jun 2002 21:08:14 +0000 |
| Subject: | Re: Newbie problem - Slashes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104212@lists.php.net to get a copy of this message | ||
You're fault. :)
Remember that quotes are used to tell the beginning and end of a string. So
if you are using a " to mean the beginning of the string, then there can't
be any " within the string itself. If there are any ", they need to be
changed to \", which means they are escaped.
magic_quotes_gpc = ON does this automatically for you when you submit values
through GET, POST, or COOKIE. You can also use the addslashes() function.
Your errors are all related to this issue.
---John Holmes...
----- Original Message -----
From: <kim@jumac.com>
To: <php-general@lists.php.net>
Sent: Thursday, June 27, 2002 4:59 PM
Subject: [PHP] Newbie problem - Slashes
>
> Hello all,
> I'm a newbie into PHP and am facing a funny problem.
>
> I have a form with a textarea named address,
> I am able to submit the form and enter the data into the database without
any problem,but to make sure that it handles "bad" data too I tested it out
with this sentance:
>
> When cheese gets it's picture taken, what does it say?
>
> then "previewed" it and the output was, (note the slash )
>
> When cheese gets it\'s picture taken, what does it say?
>
> (even entered into the database without a problem)
>
> so I further tested it with: (note the " instead of the ')
>
> When cheese gets it"s picture taken, what does it say?
>
> and the output was:
> When cheese gets it\"s picture taken, what does it say?
>
> but when I looked in the database it only showed
> When cheese gets it\
>
> any idea what the problem is? is it my fault or PHP's or MySql's?
>
> sorry if its a bit confusing, if need be I can send you all the 3 files
i'm using and the table structure, kindly help.
>
> - Kim.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>