Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6934527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:58:18+00:00 2026-05-27T11:58:18+00:00

I am working on a library/framework for my project. I would like to do

  • 0

I am working on a library/framework for my project. I would like to do a Country selector,

User picks USA it then populates a States box with all states

User picks Canada it then populates another box with all regions for Canada

User picks Mexico it then populates another box with all regions for Mexico

User picks UK it then populates another box with all regions for UK

etc… you get the idea, since it is going to be part of a framework/library I would like to make it ass complete and easy to use. SO I would like to add many different country and region combinations

Also if this is used in a project where the values are saved into a database or file or anywhere as a user setting, then when the page loads and a value is available, it should pre-populate the correct selection boxes and have the correct Country and region selected already.

Now I know Javascript is required, and I am using jQuery so It might be best to use jQuery, and also PHP.

Some questions…

1)
On a personal project, I would probably store all the country and region combinations in a MySQL database however since I want to have this be more of a drop in solution, would it be best to store a file containing ever Country option in a PHP array and then have each set of regions in a separate file as an array.

So the United States would have a separate file that would contain a PHP array of the 50 states, Canada would have a file with all it’s different staes/regions etc.. Or is there a better way?
OR should I go ahead and just store all this in MySQL or SQLite and provide the proper tables with the code

2)
Based off tutorials and stuff I think I can figure out how to make a Region/State selection box populate based off the Country that is selected from another selection box however, if a user have previously selected United States and New York, how would I go about making sure the first box is selected United States and the second box has loaded the file/contents for United States regions/states and then selected the proper states in that list

3)
Do you know of anything that exist like this already to help me more or if you would like to contribute anything even getting me in the right direction will help and be greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:58:18+00:00Added an answer on May 27, 2026 at 11:58 am

    Google for javascript country state dropdown and you’ll find lots of solutions. The first one at http://javascriptsource.com/forms/country-state-drop-down.html already seems pretty reasonable. It stores all the data in the JavaScript code—after all, there are not that many combinations. For countries where it lacks state/region information, the user can enter an arbitrary region.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Java library and would like to remove some functions from
I am currently working on a REST library for .net, and I would like
I'm working on a Python library that interfaces with a web service API. Like
I'm working on a thread library which implement user level threads (i have something
I'm working on a simulation in Qt (C++), and would like to make use
I am working on a project that requires the use of user stories and
I have been working Quartz framework in my grails project with lib called quartz-all-1.7.3.
A little background: We're building a library/framework for working with scientific models. We have
We are working on a C# windows project with enterprise library 1.0 that needs
I have been working on a project which uses Tiger's SQLite3 library (which if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.