What is the best way to deal with address inputs that can be from multiple countries?

city, country, php, street-address

Solution

First of all be careful with what you make mandatory. Don't use validations like "ZIP code must contain only numbers".

Then, you should have a minimal amount of fields - Country, City, Zip Code, and 2 lines for Address.

Check out for example this book ordering site with world-wide delivery. Put a book in your basket and head to checkout to see: https://securepayment.bookdepository.co.uk/checkout/summary

Problem

Most of my websites in the past have been rather limited to the United States when it came to displaying addresses. On a project I'm working on right now, however, users can add events from all over the world. My problem is how to go about dealing with the different way in which addresses are displayed across the world. For example, City/State/Zip is just a US thing. I was figuring I would alter the inputs displayed based on the country selected but I have no idea how I'm supposed to know the way every single country does addresses. Ideas?

Original source