RE: [PHP] List Boxes
| From: | Krznaric Michael | Date: | Fri, 28 Jul 2000 14:15:51 +0000 |
| Subject: | RE: [PHP] List Boxes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8786@lists.php.net to get a copy of this message | ||
Am I to understand in order to retrieve the values from an array, the form
element name must contain []?
Mike
-----Original Message-----
From: Andy Woolley [mailto:andy@reftech.co.uk]
Sent: Friday, July 28, 2000 9:57 AM
To: php-general@lists.php.net
Subject: Re: [PHP] List Boxes
You will need to set up a form variable as an array
When setting up the list box do somethin like this:
<select size=5 multiple name=selector[]>
<option value='value1'>Value1</option>
<option value='value2'>Value2</option>
<option value='value3'>Value3</option>
<option value='value4'>Value4</option>
<option value='value5'>Value5</option>
To display the selected values after submit do this:
<?
while (list ($key, $val) = each ($selector))
{
echo $val;
}
?>
Hope this helps
Andy.
Hi
I wonder how to get selected items values from List Box (multiple)?
I need to insert them into db.
Thanks
--
Jacek Stachowicz
jacek@atra.com.pl
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net