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;
-------------------------------------------------------------------------------
select_start
select_start
http://localhost/index.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;
-------------------------------------------------------------------------------
select_show
select_show
http://localhost/index.html
選択結(jié)果は次のとおりである。
select==>
select1==>
select2==>
戻る
-------------------------------------------------------------------------------
戻る
密山市|
鹿邑县|
温州市|
上林县|
泾源县|
东源县|
任丘市|
隆林|
滁州市|
石河子市|
巢湖市|
于都县|
来安县|
鞍山市|
禹州市|
惠东县|
荆州市|
新泰市|
惠安县|
阿拉尔市|
松潘县|
南投县|
子洲县|
镇远县|
利津县|
米泉市|
广东省|
兴和县|
米泉市|
龙山县|
高雄市|
龙口市|
成都市|
塘沽区|
修水县|
许昌市|
驻马店市|
会泽县|
观塘区|
天祝|
宁晋县|