Managing contact info

Hi...We have a contact form on our website that users fill out and submit to us.  Right now all that info is sent to one e-mail address.  We like to forward it to our closest retail location based on the users zip code.  Any ideas?  Thanks
Markv00Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

siliconbritCommented:

I dont know if you are using a backend database, such as MySQL or MSSqlServer, but this is one example using databases:

Create an email address for each of your retail locations - you probably already have these.  Store these in a table such as:

   id   | distributor          |   email  
    1   | Palo Alto            |  sfbob@mydomain.com
    2   | Gump Valley       |  gvalley@mydomain.com


Create a table with ranges of zip codes as follows:

  start    | end      | distributor
  94040  | 96049  | 1
  94030  | 96039  | 1
  10000  | 10100  | 2

Note that two rows zipcode ranges are given to one distributor here, that's so that areas can overlap.

Then, if a customer gives you a zipcode, you can find the distributor email with:

   SELECT email FROM distributors WHERE id = (SELECT distributor FROM zipcodes WHERE start <= 94041 AND end >= 94041)


There is lots of different ways to achieve the same thing.  There are more efficient ways to implement the database tables and the SQL queries - it all depends on what you want to do, what you have available and how confident you are with the techniques.  You don't even need a database as long as you are willing to maintain a file in a format similar to:

  94030 96039 sfbob@mydomain.dom
  94040 96049 sfbob@mydomain.dom

...but the principle is basically the same - record the zipcode ranges that are assigned to each distributor, and then use some lookup mechanism to find the correct distributor

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
itamar82Commented:
what language are you writing it in?
0
fridomCEO/ProgrammerCommented:
The code above is SQL and you can use it from within every programming languages.

Regards
Friedrich
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.