RE: [PHP] Illegal characters in HTML form element names.
| From: | Ford, Mike [LSS] | Date: | Tue, 17 Sep 2002 11:43:05 +0000 |
| Subject: | RE: [PHP] Illegal characters in HTML form element names. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116619@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Jared Williams [mailto:Jared.Williams@ntlworld.com]
> Sent: 11 September 2002 14:03
> To: php-general@lists.php.net
> 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 says!)
Cheers!
Mike
---------------------------------------------------------------------
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
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211