in reply to Re: Re: popup_menu from database
in thread popup_menu from database

Here is a snippet to help you on your way:
while ( my $ref = $sth->fetchrow_hashref() ) { print $q->popup_menu( -name => "some_random_name", -values => [keys %$ref], -labels => $ref, -default => 'default_key_from_ref', ); print $q->br; }

-enlil

Replies are listed 'Best First'.
Re: popup_menu from database
by powerhouse (Friar) on Apr 06, 2003 at 13:01 UTC
    thank you to everyone, I got it to work. Here is how I did it...
    %cat_options = Admin_Get_Cat_options_hash(); # Here is Admin_Get_Cat_options_hash code: sub Admin_Get_Cat_options_hash { my %options_list; $sth = $dbh->prepare (qq{ SELECT id,c_name FROM categories }); $sth->execute(); while (my ($id,$c_name) = $sth->fetchrow_array()) { $options_list{$id} = $c_name; } $sth->finish(); return(%options_list); }
    That worked.
    Thanks for the idea to have it in a sub, dws

    thx,
    Richard