> -----Original Message-----
> From: Jared Williams [mailto:[EMAIL PROTECTED]]
> Sent: 11 September 2002 14:03
> Subject: [PHP] Illegal characters in HTML form element names.
> Hi,
>     The HTML standard defines the set of characters that are 
> valid in form
> element names. It does not include [ or ]

Incorrect.  I used to think that, but was corrected by a kindly member of the PHP 
development team.

If you take a good look at the HTML 4.0 specification, the "name" attribute is defined 
as CDATA, which basically means it can contain any character.

>  and yet this seems 
> to be the only
> way to get a set of form elements grouped into an array for 
> server side
> processing.
> Why doesnt PHP do (Perl/ASP) automatically create an array 
> when there is
> more than one form element with the same name in the post/get data?

So that there will be no uncertainty over whether a particular named element will be 
an array or a scalar, thus avoiding the need to spatter is_array() tests (or (array) 
casts) all over the place.

However, the HTML 4.0 spec also says of name that "This attribute has been included 
for backwards compatibility. Applications should use the id attribute to identify 
elements", and the id attribute *is* restricted as you mention -- so perhaps this is 
still an issue to be resolved in the future.  (I haven't checked what the XHTML spec 



Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to