> -----Original Message-----
> From: John W. Holmes [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 15, 2002 9:36 PM
> To: 'Khalid El-Kary'; [EMAIL PROTECTED]
> Subject: RE: [PHP] how to user <select multiple="true">
>
> > hi,
> > If i have a form that has a <select> with multiple="ture" how would
i
> be
> > able to retireve it's multiple values in the PHP script, i tried the
> > $_REQUEST['fieldname'] it gave me only the last selected value
> >
> > note: multiple selection is done by holding ctrl :)
>
> PHP will make an array for you.
>
> <select name="foo" multiple>
> <option value=1>One</option>
> <option value=2>Two</option>
> <option value=3>Three</option>
> </select>
>
> When that is submitted, you'll have a $_REQUEST['foo'][] array
created.
> If you chose One and Three, you'd have
>
> $_REQUEST['foo'][0] ==> 1
> $_REQUEST['foo'][1] ==> 3
>
> Use count($_REQUEST['foo']) to see how many items were selected.
>
> ---John Holmes...
>
Err...name it as an array. Name="foo[]"
...like others have pointed out. :)
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php