Capturing and Storing User Location

I’m hoping there’s a simple answer to my conundrum:

When new users sign up to my app, I need there to be two dropdowns. The first will have a list of countries, and then, based on the user’s selection in the first dropdown, more specific location options will appear in the second dropdown. I would then capture and save this to the user’s profile.

An example would be:
Dropdown 1: User selects United States of America

The second drop down would then populate with a list of cities and states

Dropdown 2: User selects Los Angeles, CA

Another enigma is where would I pull these choice from in the first place? It’s obviously not reasonable to manually input all these options.

I could simply have my users manually input the information, but because this is meant to be a directory I don’t want to risk them misspelling things or using alternate spellings and fragmenting the data.

If anyone else has dealt with anything similar, your help would be greatly appreciated!

UN Location Code db may be helpful to populate dropdowns.

http://www.unece.org/cefact/codesfortrade/codes_index.html