[San-Diego-pm] Passing multiple select options

Daniel Risse dan at tierra.net
Fri Sep 14 16:02:32 PDT 2007


If a post is done, then the form data must be read from STDIN.
Something like this should work most of the time:

my $query_string;
read STDIN, $query_string, $ENV{CONTENT_LENGTH};

Then $query_string will look the same as $ENV{QUERY_STRING} for a get.
  Dan


Joel Fentin wrote:
> 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
>
>   



More information about the San-Diego-pm mailing list