Re: Underscores in submitted form data

From: Date: Wed, 21 May 2003 13:51:57 +0000
Subject: Re: Underscores in submitted form data
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-148416@lists.php.net to get a copy of this message
U're welcome. Catalin "Patrick Schnegg" <info@killersushi.ch> wrote in message news:20030521133825.96530.qmail@pb1.pair.com... > 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 > > > > > > > > > > > >

« previous php.general (#148416) next »