Loading ...
Sorry, an error occurred while loading the content.

question about cgi drop down

Expand Messages
  • Richard Taylor
    Hello group, It s getting late here... I am working on script to create a drop down box in CGI.pm. It uses a hash to set the labels for each of the items in
    Message 1 of 1 , Oct 12, 2001
    View Source
    • 0 Attachment
      Hello group,
       
      It's getting late here...
       
      I am working on script to create a drop down box in CGI.pm.  It uses a hash to set the labels for each of the items in it.  When I don't have the hash and don't set the label the script works fine.  However, once I add the hash and set the label to the value of it it returns one field with a numerical value??
       
      Any one know why?  I've tried taking out the dashes as I thought they might be throwing it off, no luck...???
       
      Richard
       
      #!/usr/bin/perl5 -w
       
      use CGI qw(:standard escapeHTML);
      use CGI::Carp qw(fatalsToBrowser);
      #use strict; 
       
      print "content-type: text/html\n\n";
       
              
      %state_labels = (
           "" => "",
           "--" => "NA - Not Applicable",
           "" => "",
           "AL" => "AL - Alabama",
           "AK" => "AK - Alaska",
           "AS" => "AS - American Samoa",
           "AZ" => "AZ - Arizona",
           "AR" => "AR - Arkansas",
           "AE" => "AE - Armed Forces",
           "AA" => "AA - Armed Forces Americas",
           "AP" => "AP - Armed Forces Pacific",
              "CA" => "CA - California",
              "CO" => "CO - Colorado",
             "CT" => "CT - Connecticut",
             "DE" => "DE - Delaware",
             "DC" => "DC - District of Columbia",
             "FM" => "FM - Federated States of Micronesia",
             "FL" => "FL - Florida",
             "GA" => "GA - Georgia",
             "GU" => "GU - Guam",
             "HI" => "HI - Hawaii",
             "ID" => "ID - Idaho",
             "IL" => "IL - Illinois",
             "IN" => "IN - Indiana",
           "IA" => "IA - Iowa",
             "KS" => "KS - Kansas",
             "KY" => "KY - Kentucky",
             "LA" => "LA - Louisiana",
             "ME" => "ME - Maine",
             "MH" => "MH - Marshall Islands",
             "MD" => "MD - Maryland",
             "MA" => "MA - Massachusetts",
             "MI" => "MI - Michigan",
             "MN" => "MN - Minnesota",
             "MS" => "MS - Mississippi",
             "MO" => "MO - Missouri",
             "MT" => "MT - Montana",
             "NE" => "NE - Nebraska",
             "NV" => "NV - Nevada",
             "NH" => "NH - New Hampshire",
             "NJ" => "NJ - New Jersey",
             "NM" => "NM - New Mexico",
             "NY" => "NY - New York",
             "NC" => "NC - North Carolina",
             "ND" => "ND - North Dakota",
             "MP" => "MP - Northern Mariana Islands",
             "OH" => "OH - Ohio",
             "OK" => "OK - Oklahoma",
             "OR" => "OR - Oregon",
             "PW" => "PW - Palau",
             "PA" => "PA - Pennsylvania",
             "RI" => "RI - Rhode Island",
             "SC" => "SC - South Carolina",
             "SD" => "SD - South Dakota",
             "TN" => "TN - Tennessee",
             "TX" => "TX - Texas",
             "UT" => "UT - Utah",
             "VT" => "VT - Vermont",
             "VA" => "VA - Virginia",
             "WA" => "WA - Washington",
             "WV" => "WV - West Virginia",
             "WI" => "WI - Wisconsin",
             "WY" => "WY - Wyoming",
             "" => "",
             "AB" => "AB - Alberta",
             "BC" => "BC - British Columbia",
             "MB" => "MB - Manitoba",
             "NB" => "NB - New Brunswick",
             "NF" => "NF - Newfoundland",
             "NT" => "NT - North West Territories",
             "NS" => "NS - Nova Scotia",
             "ON" => "ON - Ontario",
             "PE" => "PE - Prince Edward Island",
             "QC" => "QC - Quebec",
             "SK" => "SK - Saskatchewan",
             "YT" => "YT - Yukon"
          );
        
       
       
       
      #my $print_state .=
         print popup_menu ( -name => "06.State",
              -values => ["", "--", "", "AL", "AK", "AS", "AZ", "AR", "AE", "AA",
              "AP", "CA", "CO", "CT", "DE", "DC", "FM", "FL", "GA", "GU",
              "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MH",
              "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH",
              "NJ", "NM", "NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW",
              "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA",
              "WV", "WI", "WY", "", "AB", "BC", "MB", "NB", "NF", "NT",
              "NS", "ON", "PE", "QC", "SK", "YT"]
              -labels => \%state_labels);
    Your message has been successfully submitted and would be delivered to recipients shortly.