This should do the trick for database selection:
my %tmp = ();
my $html = $DB->html( ['Countries'], $IN );
my $sth = $DB->table('Countries')->select('Country_Value', 'Country_Name');
$tmp{$val} = $name while (my ($val, $name) = $sth->fetchrow);
return(
$html->select({
name => 'Country',
value => scalar $IN->param('Country'),
values => \%tmp
})
);
}
That assumes all your country names/values are in a table called "Countries" and the column names are "Country_Name" and "Country_Value"
Code:
sub { my %tmp = ();
my $html = $DB->html( ['Countries'], $IN );
my $sth = $DB->table('Countries')->select('Country_Value', 'Country_Name');
$tmp{$val} = $name while (my ($val, $name) = $sth->fetchrow);
return(
$html->select({
name => 'Country',
value => scalar $IN->param('Country'),
values => \%tmp
})
);
}
That assumes all your country names/values are in a table called "Countries" and the column names are "Country_Name" and "Country_Value"