[San-Diego-pm] Passing multiple select options

Joel Fentin joel at fentin.com
Fri Sep 14 15:24:27 PDT 2007


After multiple options are selected and the submit button is clicked, I 
can't get the mulitple options into the receiving code *if* the form 
method is post.

If the form method is get, the needed data is contained in 
$ENV{'QUERY_STRING'}.

If the form method is post, I don't know how to get it. I would prefer post.

The sending code:

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM ACTION="EditJob.pl"  METHOD="POST" 
ENCTYPE="application/x-www-form-urlencoded">
<TABLE BORDER CELLPADDING=5>
<TR>
<TD>
<SELECT NAME="teams" MULTIPLE SIZE=6>
<OPTION VALUE="b"          >blue</option>
<OPTION VALUE="g"          >green</option>
<OPTION VALUE="r"          >red</option>
<OPTION VALUE="p"          >purple</option>
<OPTION VALUE="f"          >fuschia</option>
<OPTION VALUE="m"          >mango</option>
</SELECT>
<INPUT TYPE=SUBMIT VALUE="submit">
</TD>
</TR>
</TABLE>
</FORM>
</body>
</HTML>';

Some of the receiving code:

print "Content-type: text/html\n\n";
my $key;
foreach $key(keys %ENV){print "$key=$ENV{$key}\n"}
my @Param = $co->param(); die map {$_.' = '.$co->param($_)."\n"}(@Param);

=========

perl perl perl

-- 
Joel Fentin       tel: 760-749-8863
Email:            http://fentin.com/me/ContactMe.html
Biz Website:      http://fentin.com
Personal Website: http://fentin.com/me


More information about the San-Diego-pm mailing list