how do you create an effective search box?

They have: 140 posts

Joined: Nov 2003

I'm having trouble coming up with an effective search box
for my site. It is programmed in PHP/Mysql.

The site lists businesses of different types in different towns and
most likely the people seraching for a business will know the type of
business they are looking for within that town. Sometimes they will
want to see all the different types of businesses within that town.

HOWEVER, the problem I'm running into is that I'm trying to further
break down the search by zipcode... so that in a large city... you don't
get a list of businesses that are 25 miles away... but are right where
you want them.

Right now I have it so that someone doing a search can search by
state, city, zip or business type... but not a combination of any of these to refine the search. (i.e. there is one box to enter in data and one selection box for the type of search)

Anyone know of a good way to set this up... or are there any resources for this out there?

Thanks

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You shouldn't need state&city + zip -- the zip should have that information in it.

Searching by state and city is an AND query -- where state = '$state' and city = '$city'.

So is business type -- and btype = '$spas'

So you really have state, city, zip, business type, state & city, state & city & business type, zip & business type.

The biggest issue in your zip is to sort what the approximate locations might be -- if $_POST['zip'] == $zip, related zip codes are in this array... That sort of thing.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.