Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/2winners/html_form-country-state-select

Premade Simple Country and Automatic State/Province options
https://github.com/2winners/html_form-country-state-select

form form-select html js json php

Last synced: about 1 month ago
JSON representation

Premade Simple Country and Automatic State/Province options

Awesome Lists containing this project

README

        

# 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
```json

{
"Countries": {
"CountryName": {
"option": "CountryName",
"phonecode":"0",
"States": [
"State1",
"State2"
]
},
"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