tags:

views:

21

answers:

1

I'm not even sure if form arrays is the proper term, but it looks a bit like this:

<input name='element[]' type='text' />
<input name='element[]' type='text' />

Which is then retrieved in PHP as an array stored in $_POST['element'] -- in this case with 2 values.

I've tested it in the browsers I have available to me, but I've never seen this before and I'm wondering is this supported pretty much in all browsers? Or is this something very old that I've just not run into?

Thanks!

+4  A: 

It is the server side language that turns this into an array (most languages don't require the name to end in [], that is an oddity of PHP).

As far as the browser is concerned, it is just a bunch of inputs with the same name, that get serialized using the standard rules for submitting form data. i.e.

element[]=value&element[]=value

No browser has any problems with this. It has worked this way since HTML first got a form element.

David Dorward