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==>
戻る
-------------------------------------------------------------------------------
戻る
新营市|
余庆县|
衢州市|
威海市|
米泉市|
嘉祥县|
田东县|
白玉县|
福泉市|
巩留县|
乌兰浩特市|
信丰县|
依兰县|
彰化市|
灵山县|
禄丰县|
灯塔市|
青龙|
湖北省|
孟州市|
澄城县|
托里县|
银川市|
高州市|
宣城市|
庐江县|
喀什市|
临洮县|
永丰县|
南部县|
东兴市|
宽城|
新津县|
辽宁省|
鹿泉市|
兴仁县|
聊城市|
墨玉县|
方城县|
沙雅县|
汽车|