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
選択結果は次のとおりである。
select==>
select1==>
select2==>
戻る
-------------------------------------------------------------------------------
戻る