Re: ' (Single Quotes) in user inputs
| From: | John Holmes | Date: | Thu, 14 Oct 2004 03:26:32 +0000 |
| Subject: | Re: ' (Single Quotes) in user inputs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199459@lists.php.net to get a copy of this message | ||
Ben wrote:
I am running into a problem with user input when a user inputs a single quote in the form field, such as entering O'Brien as a last name. When the user enters this, PHP adds a \ in front of the single quote, and then if the form is submitted again, adds a \ in front of the \ and again in front of the single quote. Example: <INPUT TYPE="TEXT" NAME="lastName" VALUE="$lastName"> if the user enters a name containing a single quote, such as O'Brien, it becomes <INPUT TYPE="TEXT" NAME="lastName" VALUE="O\'Brien"> Upon submitting the form again, it become <INPUT TYPE="TEXT" NAME="lastName" VALUE="O\\\'Brien"> Any ideas on dealing with this would be greatly appreciated.Search the manual for magic_quotes_gpc and stripslashes()... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com