This is for a site that relies on shipping items via UPS or FedEx. I know there is software out there that does it (http://en.wikipedia.org/wiki/Coding_Accuracy_Support_System), but if you are trying to build your own solution for a simple website.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Unless you can do it against an API provided by your shipper (UPS/Fedex/etc) or there is an official list (like the Postal Address File) - then don't.
It's annoying having to make up an incorrect address because some dumb software insists that my city needs a county, or that my house must have a number. Even worse if you assume it must be a US address
Some payment processors will require ship to address verification, meaning only allowing shipments to the bill to address. Some offer this feature as an option. You may want to see if this is available to you. For example, PayPal can be configured to only allow shipments to a valid address, as determined by the credit card bill to address. This can limit options for your customer though, so it's a trade-off.