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

In the following test2.html code user does multiple selection. When Submit is pushed,the selections are passed correctly to an array in test2.pl. (e.g. cis100cis200) However, if I pass this array in test2.pl to test3.pl as a hidden filed as a hidden field, only the first entry out of the selection is received by the array in test3.pl. (e.g. cis100) I wonder why and how to fix this problem ? Thanks.
file name: test2.html <html> <body> <form name="form1" method="post" action="/cgi-bin/test2.pl"> <select name="class" size="4" multiple> <option value="cis100">CIS100</option> <option value="cis200">CIS200</option> <option value="cis300">CIS300</option> <option value="cis600">CIS600</option> <option value="cis700">CIS700</option> </select> <input type="submit" name="submit" value="Submit"> </form> </body> #file name: test2.pl use CGI qw(:standard); print "Content-type:text/html\n\n"; @class= param('class'); print "<html><body>"; foreach $a (@class) { print "$a<br>"; }; print <<EndForm; <form name="test3" method="post" action="/cgi-bin/test3.pl"> <input type="submit" name="submit" value="Submit"> <input type="hidden" name=class value =@class> </form> EndForm print "</body></html>"; #file name: test3.pl use CGI qw(:standard); print "Content-type:text/html\n\n"; @class= param('class'); print "<html><body>"; foreach $a (@class) { print "$a<br>"; }; print "</body></html>";

Replies are listed 'Best First'.
•Re: passing array from form to form
by merlyn (Sage) on May 30, 2002 at 16:51 UTC