[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    Re: [CGI] converting to use CGI.pm for popup_menu
From:       smckenna () ncal ! verio ! com (Sean McKenna)
Date:       1998-11-28 3:18:25
[Download RAW message or body]

Sorry, left out the second hash definition in the earlier message. 

Here's what I use for this kind of thing:

@month_names = ("January", "February", "March", "April", "May",
"June",  "July", "August", "September", "October", "November",
"December");

# Create the %MONTH_ARRAY hash for the month number/names
  $month_num = 0;
  foreach $month(@month_names) {
	$month_num++;
	$MONTH_ARRAY{$month} = $month_num;
  }

# Create the %MONTH_POP hash for the month name drop down values
  $month_num = 0;
  foreach $month(@month_names) {
	$month_num++;
	$MONTH_POP{$month_num} = $month;

print $q->popup_menu(
		-name=>'month',
		-Values=>[1..$#month_names+1],
		-default=>$MONTH_ARRAY{$current_month_name},
		-labels=>\%MONTH_POP);

Hope that helps.


Sean McKenna - "All the world's a stage..."
-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
in the body.

The CGI Tips & Tricks website (and archive of the list) is located
at http://www.jann.com/Perl/

cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).

Summit Communication Design is a full-service web hosting firm
providing web design, cgi programming and inter/intra-net support.
-----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic