Just give each select its own name. Or name them all the same followed by an [] and you'll end up with a multi-dimensional array if things go right...
<select name='one'> ... <select name='two'> ---John Holmes... > -----Original Message----- > From: Victor Spång Arthursson [mailto:[EMAIL PROTECTED]] > Sent: Sunday, May 26, 2002 5:49 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Need some advice concerning forms (multi select > pulldown) and arrays > > Hello and thanks for your fast answer! > > I'ld like to know if there is any possibility to distinguish the selects > if I've multiple multiple selects, that is, more than one on the same > page? What I'm loooking for is the possibility to have an unknown number > of multiple selects on the same page.... > > Is it possible? Anyone who can describe how to do this or provide a link > to some tutorial? And also, where in the manual can I read about this? > > Sincerely, > > Victor > > On lördag, maj 25, 2002, at 08:59 , Miguel Cruz wrote: > > > Have a play with this little program - it should demonstrate all of the > > things you'd want to do with getting data in and out of mult selects. If > > it doesn't work, you may have an older version of PHP - in that case, > > change "$_REQUEST" to "$HTTP_POST_VARS" and "$_SERVER['PHP_SELF']" to > > "$PHP_SELF". > > > > --------------- > > <? > > > > $choices = array(1 => 'dog', 2 => 'cat', 3 => 'mouse', 4 => 'frog'); > > > > if (is_array($_REQUEST['animals'])) > > { > > print '<p>You chose:</p><ul>'; > > foreach ($_REQUEST['animals'] as $animal_id) > > print "<li>{$choices[$animal_id]}</li>"; > > print '</ul><hr>'; > > } > > > > ?><form method="post" action="<?= $_SERVER['PHP_SELF'] ?>"> > > <select multiple name="animals[]"><? > > > > foreach ($choices as $id => $name) > > print '<option ' > > . (in_array($id, $_REQUEST['animals']) ? 'selected ' : '') > > . "value='$id'>$name</option>"; > > > > ?></select><input type="submit"></form> > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php