Re: Hidden Input and Quotes?

From: Date: Sat, 12 May 2001 02:20:09 +0000
Subject: Re: Hidden Input and Quotes?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-52534@lists.php.net to get a copy of this message
Jason Caldwell wrote: > > The &quot; will be translated back into " > > when your form is submitted. > > ?? I don't have to convert back?? -- when I eventually submit my Hidden > Input Fields into my mySQL DB, they'll be converted back to " ? > > Confused.... If you have <input type="hidden" name="data" value="The word &quot;here&quot; is in quotes." />, then when you submit your form, $HTTP_POST_VARS["data"] or $HTTP_GET_VARS["data"] will be: The word \"here\" is in quotes. So you can put the value straight into MySQL. The slashes will not show up in MySQL. The browser converted the &quot; into ", and PHP for some reason (I still don't know why) adds slashes before your ' and " characters. If you use the value elsewhere (aside from just inserting it into MySQL), you'll have to use the stripslashes() function to get rid of the slashes.

« previous php.general (#52534) next »