Re: Retrieving data from multiple select list
| From: | Ben Cheng | Date: | Sun, 11 Mar 2001 14:27:53 +0000 |
| Subject: | Re: Retrieving data from multiple select list | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43388@lists.php.net to get a copy of this message | ||
Yeah I saw this in the online manual but is there any other way of doing this that doesn't require naming the select box in HTML with a [] at the end? Cause I have another button that calls a JavaScript to select all the options within CategoryID[] and it doesn't seem to work cause it's looking for a CategoryID[] array instead of a select box named CategoryID[].
-Ben
P.S. Please send responses directly to my email address as well since I'm in digest mode. Thanks.
At 10:05 AM +0100 3/11/01, Edi Murfy wrote:
try this: in the form: <select name="CatecoryID[]" size="3" multiple> <option value="1">Item 1</option> <option value="2">Item 2</option> <option value="3">Item 3</option> </select> in the script: $num = sizeof($CategoryID); // Number of array items for($i=0;$i<$num;$i++) { // $CategoryID[$i] --> whatever you wanna do with it... } "Ben Cheng" <ronin@darwinmail.net> schrieb im Newsbeitrag news:p05010402b6d0b285663b@[10.10.0.169]...I have a select box that allows the user to select and submit more than one selection at a time. How do I retrieve all the selections in PHP? For example, the select list is named CategoryID. But when I select more than one item and then hit submit, $CategoryID only shows me the last value of the selected items. How do I see all thevalues that have been selected?