Gossamer Forum
Home : Products : DBMan : Discussions :

Searching by City

Quote Reply
Searching by City
I have noticed a difference when searching my database by city. It works fine with IExplorer 5.5 but not with Netscape 4.7.

[Background] I am using 2 dababases. The first contains ID, city, state and country. The second contains all the data, name, street, phone, etc. The first search by state lists all the cities for that state with active records. The second search is inititated by choosing a city. This is where the problem exists.

A normal search using DBMAN for San Diego would look like this: &City=San+Diego
But searching from an HTML page sends this result:

IExplorer: &City=San% 2 0 Diego (% 2 0 is between the 2 names without the spaces. Had to put them in so it would show up in this post)
The result is correct, finding only the records with San Diego as City.

Netscape: City=San Diego (no characters between names)
The result in incorrect. Due to the space the search results includes any city with 'San'; San Francisco, San Jose, etc.
If I do a search with IExplorer for &San Diego it automatically adds the code for space as part of the search word.

Does anyone see how I can make the search work for both browsers? I've tried it with whole words on and off.

I've considered using long/short displays but I don't want San Diego listed for every record in the first search.

To see the search go to: http://ortho-k.net/doctors.htm


David L Davidson, O.D.

Improve your vision without surgery
Quote Reply
Re: Searching by City In reply to
i think you can find the solution to your problem inthe Unofficial DBMan website at:

http://webmagic.hypermart.net/dbman

I just saw it a few days ago. But can't exactly remember which section I saw it at in the website. Try the category of searching or linking/sorting.



Julian
Quote Reply
Re: Searching by City In reply to
Thanks for the tip. I spent hours searching gossamer-threads before I posted the original question. Then I spent a long time searching as you recommended. I finally solved the problem by adding a <form> to my html.pl so the output to the second database was via a form not just a URL link. It worked perfectly in both Netscape and IExplorer. I even added radio buttons to select the city. No doubt it could have been solved in a different way and maybe easier but it works.

Thanks for your input.

David L Davidson, O.D.

Improve your vision without surgery
Quote Reply
Re: Searching by City In reply to
Adding the following to your db.cgi file will help with spaces contained in links.

sub urlencode { ## Escapes a string to make it suitable for printing as a URL. ####

I noticed that it is not being displayed properly in the thread this line:
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%x",ord($1))/eg;

between the quotes it should read as 3 percent signs then 02x"

# -----------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%x",ord($1))/eg;
return $toencode;
}


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Searching by City In reply to
Thank you. I will save that info for future use.


David L Davidson, O.D.

Improve your vision without surgery