On Sun, 1 Sep 2002 11:25:50 -0700, [EMAIL PROTECTED] (Soheil Shaghaghi) wrote:
>Hi everyone, >I have a form with a list of countries (dropdown menu) >The countries are divided into 2 sections: >For simplicity lets' sue these sets: >Set 1: U.S. England, Canada, Germany >Set 2: India, Japan, France, Saint Lucia, Northern Ireland >The dropdown menu consists of the entire list. > >When the user submits the form, I want to check the country against the 2 >sets, and point the user to different sections depending on which set the >country is chosen. > >I know I can do this simple enough and just use the values 0, and 1 for each >country in each set and check based on those values. >But since I actually want to use the country somewhere else in the program, >I am looking for an alternative way to do this. >Can anyone please tell me how to do this? You have not made it entirely clear what you want to do, but I will try to answer your question. You want a user to select a country from the list, and you want to know if the country is in set1 or set2, and then later in the program use the $country value. How about: my @arr= qw(U.S., England, Canada, Germany); my $country = param("COUNTRY"); if ( grep $_ == $country, @arr ) {my $countryset=1} } else {my $countryset=2} } #later in the program you can: if ($countryset == 1) { print "My country is $country in set 1\n"} if ($countryset == 2) { print "My country is $country in set 2\n"} -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]