You are here: Re: Why is PHP substituting an underscore in my form? « PHP Programming Language « IT news, forums, messages
Re: Why is PHP substituting an underscore in my form?

Posted by Andy Hassall on 11/06/06 16:36

On Mon, 6 Nov 2006 11:35:25 +0200, "Kimmo Laine" <spam@outolempi.net> wrote:

><laredotornado@zipmail.com> wrote in message
>news:1162787385.554518.319680@e3g2000cwe.googlegroups.com...
>>
>> I'm using PHP 4.4.4. I notice for form elements that contain spaces,
>> PHP substitutes an underscore for the element name when the form is
>> submitted. For example, if I have this page (test.php)
>
>Spaces are invalid characters in name attributes. "ID and NAME tokens must
>begin with a letter ([A-Za-z]) and may be followed by any number of letters,
>digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods
>(".")." (source: <http://www.w3.org/TR/REC-html40/types.html#type-name> )

Ah, this one again. The name attribute of <input> elements et. al. are NOT of
the datatype NAME, they are CDATA, and not subject to these rules.

If they were, you would not be able to legally use the square bracket suffixes
that PHP uses when you want the post/get data to come out as an array.

The restrictions are added by PHP, as historically the register_globals
behaviour meant that the data was mapped into PHP variables, so the names must
follow the PHP variable naming scheme, and are mangled by PHP to force them to
be so if they're not.

Some previous discussions:

http://groups.google.co.uk/group/comp.lang.perl.misc/browse_thread/thread/90e3a4c7d1b851a1
http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/7060e06ab384359d
http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/86b8343ce795225e

The only places that NAME is actually used in HTML 4.01 (Transitional) is in
META for the http-equiv and name attributes, and the lang or hreflang
attributes on a few other elements.

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

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

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