I have written code to create a form to select multiple values. Below are some lines of my code to create a form to select multiple values.
my $parser = Text::CSV->new();
open($csv_fh, '<', $csv_file) or die $!;
my @headers = $parser->column_names( $parser->getline($csv_fh) );
print <<"EOF";
<FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST>
<TR><TD VALIGN=TOP><B>Type<BR></B></TD>
<SELECT NAME="$header" MULTIPLE>
EOF
foreach my $header (@headers) {
chomp($header);
print "<OPTION VALUE=\"$header\">$header</OPTION>";
}
print <<"EOF";
</SELECT></TD></TR>
<CENTER><INPUT TYPE=SUBMIT VALUE=SUBMIT></CENTER>
<INPUT TYPE=HIDDEN NAME=action VALUE=procnew>
EOF
I need help on if i select 4 values, then how to read those values and make use of that.
Also, please advise if there is any option to restrict the selection of values. For example, I want to restrict to select max 5 values only and min 1 should be selected from this form.