CGI プログラム13

戻る

#!C:/perl/bin/perl # select_start.pl # 07.11.27 use strict; use HTML::Template; my (%t,@loop,$n); # ループデータ生成 @loop = (); for $n ( 1 .. 100 ) { my %row = ( NO => $n ); # put this row into the loop by reference push(@loop, \%row); } # HTMLファイル出力 $t{template} = HTML::Template->new(filename => 'select_start.htm'); $t{template}->param(LOOP => \@loop); print $t{template}->output; 1; ------------------------------------------------------------------------------- <html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <head><title>select_start</title> <head> <body bgcolor="#fcf5ca"> <h2>select_start</h2> <a href="http://localhost/index.html">http://localhost/index.html</a> <hr> <form method="POST" action="select_show.pl"> 數(shù)量を選択し,?選択?をおしてください。<br> QTY==> <select name="SEL1"> <TMPL_LOOP NAME="LOOP"> <option value="<TMPL_VAR NAME="NO">"><TMPL_VAR NAME="NO"></option> </TMPL_LOOP> </select> <hr> 100を超えた場(chǎng)合,入力してください。<br> <div>QTY==><input type="text" name="SEL2"></div> <input type="submit" value="選択"> <input type="reset" value="取消"> </form> <hr> </body> </html> ------------------------------------------------------------------------------- #!C:/perl/bin/perl # select_show.pl # 07.11.27 use strict; use CGI qw/:standard/; use HTML::Template; my (%t); # CGIのパラメータ転送 $t{q} = new CGI; $t{select1} = $t{q}->param("SEL1"); $t{select2} = $t{q}->param("SEL2"); # 2つのデータを選別 if ($t{select2} =~ /\d*/ and $t{select2} > 100 ) { $t{select} = $t{select2}; } else { $t{select} = $t{select1}; } # HTMLファイル出力 $t{template} = HTML::Template->new(filename => 'select_show.htm'); $t{template}->param(select => $t{select}); $t{template}->param(select1 => $t{select1}); $t{template}->param(select2 => $t{select2}); print $t{template}->output; 1; ------------------------------------------------------------------------------- <html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <head><title>select_show</title> <head> <body bgcolor="#fcf5ca"> <h2>select_show</h2> <a href="http://localhost/index.html">http://localhost/index.html</a> <hr> 選択結(jié)果は次のとおりである。<br> select==><TMPL_VAR NAME="select"><br> select1==><TMPL_VAR NAME="select1"><br> select2==><TMPL_VAR NAME="select2"><br> <hr> <a href="http://localhost/scripts/select_start.pl">戻る</a> </body> </html> -------------------------------------------------------------------------------
戻る
密山市| 鹿邑县| 温州市| 上林县| 泾源县| 东源县| 任丘市| 隆林| 滁州市| 石河子市| 巢湖市| 于都县| 来安县| 鞍山市| 禹州市| 惠东县| 荆州市| 新泰市| 惠安县| 阿拉尔市| 松潘县| 南投县| 子洲县| 镇远县| 利津县| 米泉市| 广东省| 兴和县| 米泉市| 龙山县| 高雄市| 龙口市| 成都市| 塘沽区| 修水县| 许昌市| 驻马店市| 会泽县| 观塘区| 天祝| 宁晋县|