RE: [PHP] Illegal characters in HTML form element names.
| From: | Jared Williams | Date: | Tue, 17 Sep 2002 12:20:16 +0000 |
| Subject: | RE: [PHP] Illegal characters in HTML form element names. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116622@lists.php.net to get a copy of this message | ||
Hmm
http://www.w3.org/TR/html4/types.html#type-name
'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 (".").'
Seems to me, the rules for valid IDs & NAMEs are the same...
-----Original Message-----
From: Ford, Mike [LSS] [mailto:M.Ford@lmu.ac.uk]
Sent: 17 September 2002 12:43
To: 'Jared Williams'; php-general@lists.php.net
Subject: RE: [PHP] Illegal characters in HTML form element names.
> -----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