first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

PHP: “How do I create arrays in a HTML <form>?”

To get your <form> result sent as an array to your PHP script you name the <input>, <select> or <textarea> elements like this:

&lt;input name=&quot;MyArray[]&quot; /&gt;
&lt;input name=&quot;MyArray[]&quot; /&gt;
&lt;input name=&quot;MyArray[]&quot; /&gt;
&lt;input name=&quot;MyArray[]&quot; /&gt;

It’s also possible to assign specific keys to your arrays:

&lt;input name=&quot;AnotherArray[]&quot; /&gt;
&lt;input name=&quot;AnotherArray[]&quot; /&gt;
&lt;input name=&quot;AnotherArray[email]&quot; /&gt;
&lt;input name=&quot;AnotherArray[phone]&quot; /&gt;

he AnotherArray array will now contain the keys 0, 1, email and phone.

[http://us3.php.net/manual/en/faq.html.php#faq.html.arrays]

mod date: 2008-08-19T22:44:23.000Z