Hi, I've a perl script that I'm working on to get a list of options from a database presented to a user in a form. I can do the db query fine and store the variables in an array, but I can't workout how to get the array printed as a list of items in a menu.
The script is.... #!/usr/bin/perl -w use strict; use CGI; use CGI::Apache; use DBI; ### Initialise a new CGI object my $q = new CGI; ## Define the database connectin my $user = "xxxx"; my $dbh = DBI -> connect('DBI:mysql:localhost:database=gdraw;host=localhost;port=3306', $user,'xxxxx') || exit; ## Grab the datasets that are available by querying the ## 'studies' table my $statement = 'SELECT study FROM studies'; my $query = $dbh -> prepare($statement); $query -> execute(); my @studies = $query -> fetchrow_array; ## Print the web-page print $q -> header, $q -> start_html(-title => "gDRAW - Genotype Database, R & Analysis Web-interface", -style => {-src => "/css/gdraw1.css"}), "\n", $q -> h1("Existing Data"), "\n", $q -> p("You can select cohorts, markers and phenotypes to load from below"), "\n", ## Start the form $q -> start_form(-action => "", -method => "post", - enctype=>"multipart/form-data"), ## Have a pull-down box for selecting the studies that the ## user can access $q -> popup_menu(-name => 'study_select', -values => [EMAIL PROTECTED]), ## End the form $q -> endform, $q -> end_html; exit; The section that I'm having trouble with is... ## Have a pull-down box for selecting the studies that the ## user can access $q -> popup_menu(-name => 'study_select', -values => [EMAIL PROTECTED]), @studies is of length 2, but only one of these gets listed in the menu that is generated. Can anyone suggest how I go about using an array as a list of values (and labels) in a popup_menu()? Thanks for taking the time to look at this problem, Neil -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/