Re: Re: Underscores in submitted form data

From: Date: Wed, 21 May 2003 15:56:46 +0000
Subject: Re: Re: Underscores in submitted form data
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148425@lists.php.net to get a copy of this message
Just a suggestion, but it's probably bad form to use spaces in variable names (which is essentially what form field names are), even if the language allows it. --- Patrick Schnegg <info@killersushi.ch> wrote: > I was talking about the client in terms of customer. Thanks for the > answer > though, it figures. I'm just used to a different story. With ASP > spaces are > being submitted just fine. > > "Catalin Trifu" <catalin@isp-software.de> wrote in message > news:20030521130620.63156.qmail@pb1.pair.com... > > Hi, > > > > I think you mean you have a script which receives FORM data > from the > > client (the browser). > > if you have a field in a form like this: > > <INPUT type='text' name='field text'> > > this would translate in PHP as $field text which is > impossible, > because > > variable names can not have spaces > > I think that the PHP engine automatically converts the spaces > into > > underscores, so that you get a variable: > > $field_text which is a legal PHP variable. > > > > If you call phpinfo(INFO_VARIABLES); you will see that the > $_GET > > contains > > $_GET['field_text'] = 'what ever value sent back'; > > and that the > > $_SERVER["argv"] = Array ( > > [0] => field > > [1] => > text='what ever > > value sent back' > > ) > > The idea is you shout not use spaces in form input names, or > anything > > that can be transformed in a variable by PHP. > > > > Hope this helps, > > Catalin > > > > > > "Patrick Schnegg" <info@killersushi.ch> wrote in message > > news:20030521125027.45363.qmail@pb1.pair.com... > > > Hi > > > > > > I have a script that submits form data to the client. It works > fine, but > > > spaces in field names are submitted as underscores. Why is > that? Do I > need > > > to post the script? > > > > > > Greetings > > > Patrick > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== Mark Weinstock mark_weinstock@yahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com

« previous php.general (#148425) next »