Re: inserting free-form text with quotes to mysql

From: Date: Fri, 20 Jul 2001 19:05:59 +0000
Subject: Re: inserting free-form text with quotes to mysql
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58958@lists.php.net to get a copy of this message
$newstring = addslashes($oldstring); then, use $newstring for everything.... should work. ----- Original Message ----- From: "garman" <garman@students.uiuc.edu> To: <php-general@lists.php.net> 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#58958) next »