sub msc202 {
my $self = shift;
# Get CGI query object
my $q = $self->query();
my $template = $self->load_tmpl('msc202.htm') || die "error loading tmpl";
my $id = $q->param("id");
my @arr = $self->dbh->selectrow_array("SELECT id,HULL_NO,name,DATE_FORMAT(built,'%Y'),flag,memo FROM hull_no WHERE id = $id");
$template->param(id => $arr[0]);
$template->param(HULL_NO => $arr[1]);
$template->param(name => $arr[2]);
$template->param(memo => $arr[5]);
my @loop_year = ();
my $year = $arr[3];
my $select = 0;
my $flag = $arr[4];
for my $n ( 1960..2010 ) {
if ( $year == $n ) {
$select = ' SELECTED>' . $n;
} else {
$select = '>' . $n;
}
my %row = (
year => $select
);
push(@loop_year, \%row);
}
$template->param(year_loop => \@loop_year);
my @loop_flag = ();
my $sth = $self->dbh->prepare("SELECT name FROM Area");
$sth->execute;
while ( my @arr = $sth->fetchrow_array ) {
if ( $flag eq $arr[0] ) {
$select = ' SELECTED>' . $arr[0];
} else {
$select = '>' . $arr[0];
}
my %row = (
flag => $select
);
push(@loop_flag, \%row);
}
$sth->finish;
$template->param(flag_loop => \@loop_flag);
return $template->output;
}
1;
--------------------------------------------------------------------
|