Re: Multi Selection Boxes
| From: | Philip Olson | Date: | Tue, 02 Jan 2001 19:59:52 +0000 |
| Subject: | Re: Multi Selection Boxes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32312@lists.php.net to get a copy of this message | ||
The key is to use name the select as an array AND signify a "multiple"
attribute to the select. An example :
<form method="get" action="<?php print $PHP_SELF; ?>">
<select name="colors[]" multiple>
<option name="blue">blue</option>
<option name="green">green</option>
</select>
<br><input type="submit" name="submit">
</form>
<?php
// Print the chosen colors
if (is_array($colors)) {
foreach ($colors as $color) {
print "<br>$color \n";
}
}
?>
Regards,
Philip
On Tue, 2 Jan 2001, Brandon Orther wrote:
> Hello,
>
> I have a select box on a web page and I want people to be able to select
> more than just one thing. How would I get all the things they highlighted?
>
> Thank you,
>
> --------------------------------------------
> Brandon Orther
> WebIntellects Design/Development Manager
> brandon@webintellects.com
> 800-994-6364
> www.webintellects.com
> --------------------------------------------
>
>
> --
> 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
>