RE: [PHP] how to user <select multiple="true">

From: Date: Wed, 16 Oct 2002 01:35:50 +0000
Subject: RE: [PHP] how to user <select multiple="true">
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120088@lists.php.net to get a copy of this message
> 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...

« previous php.general (#120088) next »