Re: HTML <select> form element
| From: | Chris Wesley | Date: | Fri, 12 Apr 2002 22:59:20 +0000 |
| Subject: | Re: HTML <select> form element | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92819@lists.php.net to get a copy of this message | ||
Name your select element "majors[]" and when the form is submitted, your
form handler will get an array, not a scalar, called $majors. Step
through the array, and you'll get all the options that were selected.
~Chris /"\
\ / Microsoft Security Specialist:
X The moron in Oxymoron.
/ \ http://www.thebackrow.net
On Fri, 12 Apr 2002, Brian McLaughlin wrote:
> I have a tag like this on a php-generated web page.
>
> <select name=majors multiple size="6">
> <option value="Art">Art</option>
> <option value="Biology">Biology</option>
> <option value="Business and Economics">Business and
> Economics"</option>
> etc.
> etc.
> </select>
>
> My question is... since this is a multiple-select list, in the php script
> that this form calls on a submit, how do I determine which options have been
> selected? If I look at $majors, it is a string whose value is one of the
> several options that were selected.