Re: multiple select statement
| From: | Hugh Bothwell | Date: | Thu, 23 Aug 2001 13:57:22 +0000 |
| Subject: | Re: multiple select statement | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64086@lists.php.net to get a copy of this message | ||
"Natasha" <voidcore@yahoo.co.in> wrote in message
news:998573804.43601@wwli.com...
> hi,
>
> i want to know how i can get all selected values of a multiple select
statement using $HTTP_POST_VARS
The name of your select must be an array, ie
<select name='myvar[]' multiple>
<option>A
<option>B
<option>C
</select>
If A and B are selected, you will get $myvar[0] = 'A' and $myvar[1] = 'B'
(for example).
The safe way to enumerate the values is with foreach, ie
foreach($myvar as $val) {
// do something with $val
}
Hope this helps.