in reply to building Drop down menu - from a flat file
------------------------------------------------------------# Flat file ac 193.0.0.193 Ascension Island as 128.250.1.21 American Samoa be 192.36.125.2 Belgium biz 209.173.53.162 US BIZ
------------------------------------------------------------# send data to template my @root_loop = &get_roots; my $template = HTML::Template->new(filename => 'Digbeta/digauthform.tm +pl', die_on_bad_params => 0); $template->param(root_loop => @root_loop); print $template->output;
------------------------------------------------------------# create Array of Hashes sub get_roots { my @root_loop; open(ROOTS, "roots3"); foreach (<ROOTS>) { chomp; my ($code, $ip, $country) = /(.*)\t(.*)\t(.*)/; my %roots_row = ( code => $code, ip_addy => $ip, country => $country ); push(@root_loop, \%roots_row); } return \@root_loop; }
# HTML Template <select NAME="server"> <option SELECTED VALUE="Default">Default (as per Query Type) <TMPL_IF root_loop> <TMPL_LOOP NAME="root_loop"> <option VALUE="<TMPL_VAR NAME="code">"><TMPL_VAR NAME="code"> - < +TMPL_VAR NAME="country"> </TMPL_LOOP> </TMPL_IF> </select>
|
|---|