Jump to content

[SOLVED] ZIP/ Postal Code Look-up feature


AndrewJ1313

Recommended Posts

I would like to at a ZIP/ Postal Code look-up to a site. There are basically 22 zones covering the U.S and Canada and I would like to direct users to certain information depending on what ZIP code they enter. In most cases, entire states are in one zone.

 

My question is, is there a way to write an IF statement that would cover a number range?

 

An example would be I want all ZIP codes ranging from 40000 through 49999 to be directed to zone 1. Can I write this without saying:

 

IF $zip = "40000" || $zip = "40001 || $zip = "40002" ... 

 

Please let me know if this makes sense or if I need to clarify what I'm doing.

 

Thanks for all responses,

Andrew

 

Link to comment
Share on other sites

if($zip >= 40000 && $zip <= 49999)

 

 

You know, the minute I posted this, I started to think I was over thinking the whole thing:) Thanks this will help.

 

And just in case anyone knows a better way to build a ZIP code look-up feature, I'm all ears...or eyes in the case of blogging.

 

Many thanks for the help.

 

Andrew

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.