John W. Holmes wrote:
well I think you answered your own query - it could look for multiple names ...use [] in your select box name. When it comes back in the $_POST array you will have an array of options. It breaks HTML standardNo, it does not break HTML standards -- that is a PHP urban myth(which,tomy chagrin, I helped to propagate before a wiser head sent me toreadsaidstandards in minute detail). It does not even break XHTMLstandards.Believe me -- I've interrogated the damn standards to within an inchoftheir lives, and they nonetheless insist that [] are legalcharacters inform element name= attributes, and form element name= attributes are*not*deprecated.while I agree that it doesn't break standards - I do find it odd. and annoying in that it limits the ability of php to process certain forms ... I don't see any benefit of this system - it would be better if phpjustcreated an array for suitable form data - without requiring that the element name changes.
How does php know what "suitable form data" is?
I guess it could look for multiple names in the GET or POST data. But
then that would mean for every variable it goes to create, it would have
to go and look if it's already created one by that name. If it did,
erase the old one and make these two an array now.
Rather than doing that, it can just look for [] in the name and it knows
to make that an array.
this seems to work well in other systems - eg Perl:CGI and Java Servlets - though as these have seperate types for an array - so it works quite naturally there.
in fact I have only seen this construct in php - it seems odd to me.
I have worked on several projects where forms have been used to communicate between systems under the control of different development teams - in this case the requirement to rename the form element for it to work as a select multiple has been a pain.
--
Sean
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php