in reply to Selecting more than one option on form.

The "select" tag has a "multiple" attribute that allows you to select more than one entry.

<tr> <td align="left"><strong>Choose data:</strong></td> <td> <select name="collab" size="1" multiple="multiple"> <option /> <option> First Selection</option> <option> Second Selection</option> <option> Third Selection</option> <option> Fourth Selection</option> </select> </td>

In cases like this, CGI::param returns a list of all the selected items.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re: (nrd) Re: Selecting more than one option on form.
by newrisedesigns (Curate) on Nov 06, 2002 at 14:28 UTC

    Anonymonk should note that davorg is super++ because adding multiple="multiple" will make the code XHTML compliant, and who doesn't want that? :)

    John J Reiser
    newrisedesigns.com

Re: Re: Selecting more than one option on form.
by Anonymous Monk on Nov 06, 2002 at 15:15 UTC
    Thanks but the output in my email is still one value. Here is how I am using param in my cgi:
    use CGI qw(:standard); # bundle up form submissions into a mail_body $mail_body = ''; foreach $field (param) { foreach $value (param($field)) { $mail_body .= "$field: $value\n"; } } open (MAIL,"|$sendmail") || die "Can't open sendmail pipe: $!\n"; print MAIL <<"EOF"; To: You From: Me Subject: web data $mail_body EOF