"Hank Tt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Given the following querystring generated by, for example, a multi-select
> form list (menu), the contents of $_GET['list'] is expected to be an array
> holding 3 elements:
>
> http://awebsite.net/formlist.php?list=2&list=3&list=99
>
> Yet I only see the last value returned as a lone string.  Is this
expected?
>
> Thanks.

Yup it's working perfectly.  $_GET['list'] overwrites $_GET['list']
overwrites $_GET['list'].  You will only ever see the last one.  Instead add
square brackets to each variable name..

http://awebsite.net/formlist.php?list[]=2&list[]=3&list[]=99

Now $_GET['list'] is an array wth three elements.

echo $_GET['list'][0]; // prints 2
echo $_GET['list'][1]; // prints 3
echo $_GET['list'][2]; // prints 99

To do this within your multi-select form field add the square brackets to
the field name...

<select name="list[]" select-multi>
<option></option>
<option></option>
<option></option>
</select>

In the future you might consider performing a search on Google Groups prior
to posting on the list.  9 out of 10 times you'll find the answer you're
looking for.  This topic is particularly common.

-Kevin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to