Hi Eric, > -----Original Message----- > > $html .= $cgi->popup_menu(-name => 'id', -values => \%terms); > > where: > > -name is the name of the parameter I want returned > -values is a reference to a hash containing id and value pairs. > > The problem is that -values is a hash, and when CGI.pm displays the > pop-up menu the items do not come out sorted. (They were inserted into > the hash in a sorted order.)
>From the docs [1] it appears that values should actually be an array reference so maybe the following would work: $html .= $cgi->popup_menu( -name => 'id', -values => [ sort keys %terms ], -labels => \%terms ); It just creates an anonymous array of sorted keys from the terms hash. The labels option is used to show the term names rather than the IDs in the menu. I haven't actually tested it, but give it a shot (see the docs for more info) -Brian [1] http://search.cpan.org/dist/CGI.pm/CGI.pm#CREATING_A_POPUP_MENU