PHP Function to List States and Preselect the Present Value

Howto
(actually written sunday but i had other more important things on my blog so i figured i'd stuff this one lower in the list for the search engines) Here's the issue:  You have a lot of database fields that record one of the 50 United States of America.  You want to repeatedly show a dropdown list of all the states and pre-select the one that is currently stored in the database.  If no value is selected you want the dropdown list to just say "select a state". I wrote a nice little PHP function to take care of this need for me in my latest app and thought it might be useful to the community at large so here it is: database stuff: your database has a table named "states"…
Read More