Skip to content

2winners/HTML_Form-country-State-Select

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTML_Form-country-State-Select

Premade Simple Country and Automatic State/Province options
uses : #HTML #PHP #JS #JSON

This HTML - PHP - JS code can be used to easy implement a SELECT form field where you want any country and then Any state of that country the simple json format where the options are Pre Optioned and just need to be print or inserted into the HTML

{
  "Countries": {
    "CountryName": {
      "option": "<option value='CountryName'>CountryName</option>",
      "phonecode":"0",
      "States": [
        "<option value='State1'>State1</option>",
        "<option value='State2'>State2</option>"
      ]
    },
    "United Kingdom":{
       "Option":"\u003Coption value='United Kingdom'\u003EUnited Kingdom\u003C\/option\u003E",
       "phonecode":"44",
       "States":{
          "England":"\u003Coption value='England'\u003EEngland\u003C\/option\u003E",
          "Northern Ireland":"\u003Coption value='Northern Ireland'\u003ENorthern Ireland\u003C\/option\u003E",
          "Scotland":"\u003Coption value='Scotland'\u003EScotland\u003C\/option\u003E",
          "Wales":"\u003Coption value='Wales'\u003EWales\u003C\/option\u003E"
       }
    },
    ...
  }
}

The Example_Location.php + Options.json can be run directly and is a functioning form that can be posted to try it.

The Barebones.php + Options.json file is all thats needed to make it work

About

Premade Simple Country and Automatic State/Province options

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages