You are here: Re: Cannot use "-" in variable names? « PHP Programming Language « IT news, forums, messages
Re: Cannot use "-" in variable names?

Posted by Justin Koivisto on 12/09/05 23:12

Malcolm Dew-Jones wrote:
> Justin Koivisto (justin@koivi.com) wrote:
>
> : Kim André Akerø wrote:
> : >
> : > You can safely use "_" (underscore) instead. If you need to use it in a
> : > query string or form field, use $_POST, $_GET or $_REQUEST.
>
> : - characters in those arrays are replaced by _ automagically...
>
> There must be a config setting to do that, cause I have never observed
> that behaviour. The following uses - in the html parameter names.
>
>
> <?php
>
> echo "the-name = [";
> echo $_REQUEST['the-name'];
> echo "]\n";
>
>
> echo "hidden-name = [";
> echo $_REQUEST['hidden-name'];
> echo "]\n";
>
> ?>
>
> <form>
>
> <input type="text" name="the-name" />
>
> <input type="hidden" name="hidden-name" value="a hidden value" />
>
> <input type=submit />
>
> </form>
>
>

Now I wonder if I have that mixed up with something else dealing with
hyphens in the field names of posted forms... (PDF forms perhaps?)

I know it came up once in a script I was debugging a couple years ago,
so maybe it was something from a previous version, or maybe it was if
register_globals = 1

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация