On 11 February 2004 21:39, Ben Ramsey wrote:

> Ah-ha!  I missed that, and I always do.  Let's hope I don't anymore.
> While we're on the subject, why is PHP set up this way?  Why can't it
> just add the elements to the array automatically, since adding the
> square brackets to one's HTML form name is not a standard practice?

Well, then you would get the tradeoff that you have to test whether the value supplied 
is a simple scalar (because only one option was checked) or an array, before you could 
work with it.  IIRC, that's what you do in perl and ASP.  PHP takes the attitude that 
the code should be as simple as possible, and therefore it's the FORM's responsibility 
to indicate where POSTed values should be treated as arrays.

Personally, I think I could live with having to write code such as $checkboxes = 
(array)$checkboxes, but this is a choice the PHP implementers have taken, and I don't 
see it changing in the foreseeable future.

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

Reply via email to