Ok I think this will work for you... it is kink of clunky but it will do what you want...
####CHANGE#####
Insert the following sub-routine in the appropriate db_html.pl, originally I said to put it in the db.cgi but that would not be the best idea if you ever start to use more than one database.
Code:
sub combined_field_search {
# --------------------------------------------------------
# This sub will let you search on specific fields
# from just one field in the search form. The
# name in the search form must be unique, meaning
# that it can not be the same name as any of your
# fields in the db.cfg.
# Set this to the unique name from the search form
### SET THIS VARIABLE ###
my ($search_term) = 'city_search';
# Set this list below to match the field names that you
# would like to search from your one input field.
# The list should be seperated with commas and each
# field should be enclosed with singe quote "'".
### SET THIS VARIABLE ###
my (@multi_fields) = ('city','cities');
# Check to see $search_term was even queried
# if not then we don't need to do anything
if (!$in{$search_term}) { return; }
# Now we know that we are going to need to search
# more than one field on this search so we
# are going to populate the $in variable as if the
# search was made individually for each field
my ($field);
foreach $field (@multi_fields) {
$in{$field} = $in{$search_term};
}
# If Match Any is off this search will only
# return the records where all of the fields
# contain the search term.
$in{'ma'} = 'on';
}
Then in the "sub view_records" add the following code just above the line that reads:
my ($status, @hits) = &query("view");
Code:
# Added this sub to populate the $in variable
# with some more search fields if neccessary
&combined_field_search;
So your sub view_records should look like this: (You could actually just replace the sub with the code below)
Code:
sub view_records {
# --------------------------------------------------------
# This is called when a user is searching the database for
# viewing. All the work is done in query() and the routines just
# checks to see if the search was successful or not and returns
# the user to the appropriate page.
# Added this sub to populate the $in variable
# with some more search fields if neccessary
&combined_field_search;
my ($status, @hits) = &query("view");
if ($status eq "ok") {
&html_view_success(@hits);
}
else {
&html_view_failure($status);
}
}
Now in your db.html search form you should set up your input line so that the name matches the name you assigned to $search_term above. In the code above it is assigned "city_search":
Example:
<input type="text" name="city_search" size="40">
Got it?
Good luck,
Steve Plant
------------------
_____________________________________
OutreachONE Media Services
www.or1.com [This message has been edited by StevePlant (edited October 13, 1999).]
[This message has been edited by StevePlant (edited October 14, 1999).]