Is it legal to have an HTML form with more than one \"hidden\" control element with the same name? I expect to get the values of all of these elements at the server. If it i
Yes, and most application servers will collect the matching elements and concatenate them with commas, such that a form like this:
... would resolve to a URL (in the GET case -- POST would work the same way, though) like this:
http://myhost.com/myscript.asp?myHidden=1&myHidden=2&myHidden=3
... and would be exposed to you in code like this: (e.g., following something like Response.Write(Request.QueryString("myHidden")):
1, 2, 3
So to grab the values, you'd just split the string and access them as an array (or whatever's comparable in your language of choice).
(Should be clarified: In PHP, it's slightly different (as Johnathan points out, bracket notation exposes the items as an array to your PHP code), but ASP, ASP.NET, and ColdFusion all expose the values as a comma-separated list. So yes, the duplicate naming is completely valid.)