Okay. I think I have it now.
(Sorry. I'm a bit slow sometimes.)
The easiest way to do this is to use a multiple select field.
Add the following to your db.cgi script
Code:
sub build_multiple_select_field {
# --------------------------------------------------------
# Builds a SELECT field based on information found
# in the database definition.
#
my ($column, $value, $size) = @_;
my ($size, %values);
$name | | ($name = $column);
$size | | ($size = 1);
@fields = split (/\,/, $db_select_fields{"$column"});
%values = split (/\Q$db_delim\E/, $value);
($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";
$output = qq|<SELECT NAME="$name" MULTIPLE SIZE=$size><OPTION>---|;
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}
You'll need to have a select field defined in your .cfg file with all the states in it.
Also, it would be a very good idea to have separate input and search forms. Use the multiple select field for the input, but a "single" select field for the search.
To print out the multiple select field, use
print &build_multiple_select_field("State","$rec{'State'}",3);
The
3 above is the size of your select field.
I haven't used this directly, but I've used something similar that worked very well.
------------------
JPD