note 55624 added to faq.html
| From: | fuchs at michaelfuchs dot org | Date: | Tue, 09 Aug 2005 07:54:55 +0000 |
| Subject: | note 55624 added to faq.html | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-93287@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/faq.html.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55624
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55624&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55624&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55624&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55624&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55624&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55624&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55624&report=yes
Search -- http://master.php.net/manage/user-notes.php