Use empty brackets in the name attribute, e.g., <SELECT NAME="form[]"
MULTIPLE>. PHP will then create an array indexed by numbers. PHP will
automatically assign indices in assignments if you omit the index: 

<?
$array[] = "foo";
$array[] = "bar";
echo $array[0]."<br>";
echo $array[1]."<br>";
?>

Kirk

> -----Original Message-----
> From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]]
> Subject: [PHP] Multiple select box and form submitting
> 
> i've got a multiple select on a form and want to
> find out *all* selected values.
> 
> the form looks like so:
> 
> <SELECT NAME="form[category]" MULTIPLE>
> <OPTION VALUE="0">First
> <OPTION VALUE="1">Second
> <OPTION VALUE="2">Third
> </SELECT>
> 
> when the form submits, $form['category'] is not
> an array of selected values, but rather a single
> value.  even if i select two or three things,
> $form['category'] is still one value.  can
> anyone tell me how to get a list of all selected
> values in the box? 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to