note 55624 deleted from faq.html by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 14:53:39 +0000 |
| Subject: | note 55624 deleted from faq.html by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197204@lists.php.net to get a copy of this message | ||
Note Submitter: fuchs at michaelfuchs dot org
----
Here's a new one, which might cause problems for people:
To make my multiple select box contents accessible to both PHP and JavaScript (using
getElementById()), I was using both name and id attributes - and naming them the same, for
consistency:
<select multiple="multiple" id="bob[]" name="bob[]">
However, I've discovered that - for reasons unknown - using the brackets in the id causes only
a single value (rather than multiple values) to get returned to the $_POST['bob'] array.
What you want is:
<select multiple="multiple" id="bob" name="bob[]">
Hope this saves some time/frustration.