Re: using foreach() to capture multiple selections
| From: | Greg Donald | Date: | Tue, 21 Sep 2004 19:39:26 +0000 |
| Subject: | Re: using foreach() to capture multiple selections | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197469@lists.php.net to get a copy of this message | ||
On Tue, 21 Sep 2004 20:26:04 +0100, Luke Mackenzie <luke@lukem.co.uk> wrote:
> i would like to to put multiple selections from a form list into a single
> variable using foreach but am unsure how to do so.
>
> can someone advise how to adapt the following code?
<?php
print "You are interested in: ";
print "<select multiple name=\"select_field[]\">";
foreach($myGoals as $key => $value)
{
print "<option value=\"$key\">$value</option>";
}
print "</select>";
?>
untested..
--
Greg Donald
http://gdconsultants.com/
http://destiney.com/