In this PHP exercise, you will again use the list of cities in Arrays Exercise #2. Here's the list, this time including countries as well as cities:
Tokyo, Japan; Mexico City, Mexico; New York City, USA; Mumbai, India; Seoul, Korea; Shanghai, China; Lagos, Nigeria; Buenos Aires, Argentina; Cairo, Egypt; London, England.
This time, create an associative array, using the countries as keys, the cities as values. Create a form for the user, with the instructions Please choose a city:
Follow this request with a select field for the 10 cities, with the options created by looping through the array. When the user clicks the submit button, return the statement $city is in $country., where $city is the value chosen by the user, and $country is its key.
Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"