$newstring = addslashes($oldstring);

then, use $newstring for everything....   should work.

----- Original Message -----
From: "garman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 20, 2001 11:57 AM
Subject: [PHP] inserting free-form text with quotes to mysql


> I'm creating a specialized "suggestion box" type of web application in
PHP.
> I'm using MySQL for data storage.
>
> Whenever I try to submit text that contains a double quote character ("),
the
> submission gets truncated at the first occurance of a double quote and
beyond.
>  Single quotes don't seem to be problematic.
>
> So if the user inputted the following text:
>
>     hello " my suggestion for deals with improving the...
>
> then only "hello" would get put in the database, and everything from the
> double quote to the end of the input would be truncated.
>
> I've tried addslashes() and removeslashes() before the submit, but that
> doesn't seem to help.
>
> The input data actually gets POST'ed twice: once when the user submits his
> form.  After he submits, I bring up a "verification" form, where I show
what
> the user submitted so he can check to make sure everything is accurate.
From
> the verification page, I call another php page to actually do the database
> writing.  (Note, when I played with add/removeslashes(), I was doing so on
the
> last php page, i.e., where the database operation actually takes place).
>
> I've noticed that either PHP, my browser, or the webserver seem to add
slashes
> automatically because any quotes (single or double) or slashes are escaped
> with a slash on the verification page.
>
> Hopefully this is just something simple I'm overlooking :)
>
> Thanks,
> Matt
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to