Create Three Dropdown Lists using HTML/PHP and Ajax
$2-7 USD
Completed
Posted over 13 years ago
$2-7 USD
Paid on delivery
**Three Dropdown Lists and Submit Button:**
* Country
* Region
* City
**Region changes based on country and cities changes based on region. If country doesn't have region then cities loads based on country.
If user click submit, show the city name on label.** **
All the above should not cause full postback page, postback partially, so i guess its Ajax or jQuery, i don't know.** **
Language: PHP**
**THAT'S IT
**
-----------------------------------------
I have the SQL table schema and the appropriate queries ready.
**Here is the database, it is in T-SQL, you could tweak it for MySQL (don't change the design):**
CREATE TABLE Country
(
countryID int IDENTITY (5,3) PRIMARY KEY,
countryName nvarchar(50) NOT NULL
);
CREATE TABLE Region
(
regionID int IDENTITY (8,3) PRIMARY KEY,
countryID int NOT NULL REFERENCES Country(countryID),
regionName nvarchar(20) NOT NULL
);
CREATE TABLE City
(
cityID int IDENTITY (11,3) PRIMARY KEY,
regionID int NOT NULL REFERENCES Region(regionID),
cityName nvarchar(40) NOT NULL
);
-------------
**Note:** countries that don't have region, put region name as: "------" 6 dashes.
--------------
**
SQL Queries**
Get cities based on selected region:
SELECT * FROM City WHERE regionID = ##
Get regions based on selected country:
SELECT * FROM Region WHERE countryID = ##
--------------
## Deliverables
**If you need more clarification, let me know.**