So, I have these two subroutines, match_state() and display_form that I am
having problems with. If the script is run with $state getting the function
argument, it prints a blank pulll-down menu and is able to print "Quadrants
covering West Virginia" . But, when $state is explicity set to "West
Virginia", it displays the options as they should be (pull-down menu is
complete).
Any ideas on what could be wrong?
thanks,
Al
sub match_state($FORM{$name})
#### match selected State Name with Quadrants covering the State
{
my $state = $_[0] ;
######### Problem ! ########
## when $state gets string set as below (works for any state)
## the script works and displays the options.
## does not work with $state set to function argument as above.
## uncomment below and displays correctly
#########
#my $state = "West Virginia" ;
##### Quadrants covering $state ###############
print "Quadrants covering $state:\n" ; ##this always works
#### dont think it is assigning things to %state_hash
for $href (@landhashes) {
if ($href->{st_name1} eq "$state") {
#print "$href->{quad_name}, $href->{st_name1}\n" ;
$state_hash{"$href->{quad_name}"} = "$href->{st_name1}" ;
}
elsif ($href->{st_name2} eq "$state") {
#print "$href->{quad_name}, $href->{st_name1}\n" ;
$state_hash{"$href->{quad_name}"} = "$href->{st_name1}" ;
}
elsif ($href->{st_name3} eq "$state") {
#print "$href->{quad_name}, $href->{st_name1}\n" ;
$state_hash{"$href->{quad_name}"} = "$href->{st_name1}" ;
}
elsif ($href->{st_name4} eq "$state") {
#print "$href->{quad_name}, $href->{st_name1}\n" ;
$state_hash{"$href->{quad_name}"} = "$href->{st_name1}" ;
}
}
}
sub display_form
{
print <<"EOT" ;
<FORM method=POST action="path/script2.pl"> #pass to next script
<B>Select Quadrant: </B>
<select NAME="quad">
EOT
# selection options
##############
##### Problem ???? only prints when $state is
##### explicitly set to some state string
######
while ( ($key, $value) = each %state_hash ) {
print "<option VALUE=\"$key\">$key, $value\n" ;
}
print <<"EOT" ;
</select>
<P><BR>
<CENTER>
<input type="submit" value="Continue">
<input type="reset" value="Reset">
</CENTER>
</form>
EOT
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]