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>";
In reply to passing array from form to form by bmcc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |