I work up this morning to hear on Radio 4 News that Kosovo might soon become a new country.
Ethnic purity, making wars and therefore killing people over something as accidental (or in some cases man-made) as a border seems to me to be evil and stupid.
But what does it mean for us right now? It means we’ll have to add another country to our country drop-down lists.
PHP Form with Country Drop-down – Remembering What the User Entered
Here is a zip file containing a PHP example of a form with a country drop down list. If you are creating a form, it is annoying for the user if they make a mistake on the form, and then when they go back to correct the mistake, the form has forgotten all the values they have already typed in. This is easy to fix for text boxes, but less so for drop-down boxes. The zip file has been setup to allow the form to remember the country the user selected.
It uses PHP’s variable variables to do it. This is just an example, you could the countries into a database table to generate the drop-down, but here, I have just supplied the HTML.
If you prefer to use SQL to build the code for the dropdown list dynamically, this might help : here is the SQL for loading a table with the country codes and country names.