View Full Version : Need Help Creating a Search Box (zip codes) within my site.

12-06-2006, 10:44 PM
OK first off, I'm sorry if this topic was covered before, but I really need some help...

I'm creating a website and one of the requirements is that there should be a seach box situated in the left nav, where the user can type in their zip codes. The search would then automatically bring the user to one of the 50 state pages already created throughout my site, saying something like "congratulations there are multiple dealerships near xxxxx (zip code). (This can't be a google search engine either...just type in your zip and it brings to whatever state page that zip code falls under)

I don't know where to begin as I'm not really familiar with this sort of thing and was hoping to see if anyone had a suggestion, or tutorial or anything like that....

any help would be greatly appreciated. Thanks!

12-07-2006, 12:44 AM
Get your hands on a database of Zip Codes and their associated states. Some of these also include latitude/longitude information if you later want to perform the math to determine which dealership is *closest* to that zip code, but it doesn't sound like you're going that route just yet.

Once you've got a table set up with all the zip codes, the query then becomes "SELECT state FROM {{table name}} WHERE zip_code = '{{submitted zip code}} LIMIT 1" and do a redirect off of that returned result.

12-07-2006, 04:58 AM
Thank you very much...I really appreciate you responding to my post. You've given me that starting point I needed badly...i'll let you know how it turns out....Thank you again!