use strict; use warnings; use DBI; use CGI::Pretty qw(:standard); my $dbh = DBI->connect( qw(DBI:driver:database:host user pass), {RaiseError=>1}, ); my $sth = $dbh->prepare('select id,name from director order by name'); $sth->execute; my $users = $sth->fetchall_arrayref({}); print header, start_form('select_user'), popup_menu('user', [ map $_->{id}, @$users ], undef, { map {$_->{id} => $_->{name}} @$users }, ), p(submit), end_form, ;