Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,
I have a html code containing muliple selection drop down menu. If i choose more than one value and on submission, a perl program should catch the selected values from this form. How can i do that?
html code is as follows
............................
<HTML> <HEAD> <TITLE> Multipe </TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <form name="test" method="post" action="/cgi-bin/test.pl"> Multiple Selection <select MULTIPLE name="sel"> <option value="one">one</option> <option value="two">two</option> <option value="three">three</option> <option value="four">four</option> </select> <input type="submit" name="submit" value="submit"> <form> </BODY> </HTML>
Thanking you rs

Replies are listed 'Best First'.
Re: Multiple selection value- Need a small perl script
by hmerrill (Friar) on Jan 21, 2004 at 20:29 UTC
    Read the perldocs on the CGI.pm module by doing
    perldoc CGI
    at a command prompt. In there you'll find the pieces for this:
    use CGI; # load CGI routines $q = new CGI; # create new CGI object @values = $q->param('foo');
    Now, translated to your SELECT box it might look something like this:
    use CGI; # load CGI routines $q = new CGI; # create new CGI object @select_values = $q->param('sel');
    HTH.
Re: Multiple selection value- Need a small perl script
by b10m (Vicar) on Jan 21, 2004 at 20:14 UTC

    You probably want to take a look at CGI. Example:

    #!/usr/bin/perl -w use CGI qw/:standard/; use Data::Dumper; my $q = new CGI; print header, start_html(); print Dumper $q->param('sel'); print end_html;
    --
    b10m