RE: [PHP] Illegal characters in HTML form element names.

2002-09-17 Thread Ford, Mike [LSS]

 -Original Message-
 From: Jared Williams [mailto:[EMAIL PROTECTED]]
 Sent: 11 September 2002 14:03
 To: [EMAIL PROTECTED]
 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: [EMAIL PROTECTED]
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




RE: [PHP] Illegal characters in HTML form element names.

2002-09-17 Thread Jared Williams


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:[EMAIL PROTECTED]] 
Sent: 17 September 2002 12:43
To: 'Jared Williams'; [EMAIL PROTECTED]
Subject: RE: [PHP] Illegal characters in HTML form element names.


 -Original Message-
 From: Jared Williams [mailto:[EMAIL PROTECTED]]
 Sent: 11 September 2002 14:03
 To: [EMAIL PROTECTED]
 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: [EMAIL PROTECTED]
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




RE: [PHP] Illegal characters in HTML form element names.

2002-09-17 Thread Ford, Mike [LSS]

 -Original Message-
 From: Jared Williams [mailto:[EMAIL PROTECTED]]
 Sent: 17 September 2002 13:20
 
 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...

But the value of the name attribute of a form element is not a NAME token.

http://www.w3.org/TR/html401/interact/forms.html#adef-name-FORM

'name = cdata [CI] 
'This attribute names the element so that it may be referred to from style
sheets or scripts.'

followed by the note I quoted previously.

On the other hand, the value of the id attribute *is* a NAME token, so is
restricted as per your quote above.

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: [EMAIL PROTECTED]
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