This changes the default behavior of the customer signup form to show the states as a drop-down list and sets the default country to the United States. The country dropdown is configurable by using the ID code from the "countries" table in the db.
This was posted in a forum by bluepony, and I found it so valuable that I decided to post it as a contribution. All credit goes to him!
Here's the relevant post:
http://forums.oscommerce.com/index.php?showtopic=94671&view=findpost&p=375353
Legend: 
Download

Report
The problem with this contribution is that the drop down list is the entire zone file so that it includes more than the states for the selected country and if you don't have the entire world zone file from http://www.oscommerce.com/community/contributions,1792 then your customers from zones not in your list are forced to choose an incorrect zone (state). I was in the middle of struggling to correct this when I stumbled on a contribution that already solved it and is much better in all respects. Here it is:
http://www.oscommerce.com/community/contributions,2028
http://forums.oscommerce.com/index.php?showtopic=88987
The attached file is a copy of this message only.
I just made a slight modification to Tim Elam's submission. This is a very simple addition. His code changed the 'Text' field that currently is the form element for the State field on any of the address forms and made them into dropdown boxes. Great contrib!
My addition to his code is extremely simple in that what it does is checks to see if the address book entry is an existing one being edited. If it's not a new entry, then my code will get the respective current State name and automatically preselect it for you in the State dropdown box.
The included file is Tim's original HTML instructions with my introduction in the beginning, all of his code/instructions (completely unmodified), then mine is at the very bottom of his instructions. A very nice sequential progression through the installation process is then acheived.
I thought this would prove quite helpful hopefully.
Enjoy
Rik Davis
Great Addition! I just updated Instructions.htm to show the correct path to the /modules directory for 2 of the 3 files: catalog/includes/modules
Thanks a bundle.
-jp
Select State/Province from Dropdown Menu & Set Country to Store Default
What's New in this Version?
In this version I have updated the installation instructions for a manual install, no files to copy over! This contribution creates a dropdown menu which contains states/provinces and sets the country to the store default country.
Instructions included to update the following three files:
catalog/create_account.php
catalog/modules/address_book_details.php
catalog/modules/checkout_new_address.php
I used this patch and received errors when selecting certain states IE: Michigan, Minnesota, Mississippi etc...
The query that returns the zone_id to be inserted:
$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' an
d (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
Will return any state starting with the 2 characters from the zone code IE: MI returns Michigan, Minnesota, Mississippi etc...
I fixed this by removing the zone_name part of the query. I've attached an updated version of the create_account.php file but you will have to make this change anywhere else in the system where you are using the state dropdown.
First off, Mary's idea below is very important. If your customer screws up the state, it affects taxes because oscommerce by default doesn't take into account state abbreviations or mispellings.
Anyways, my contribution is simply this. Apply Mary's recommended change to the following modules as well.
checkout_new_address.php
address_book_details.php
This will give her same functionality to 3 other parts of oscommerce where you either add a new address to your account or edit it.
Note: the file that comes with this is empty, no need to download anything.
This is a very modest and simple patch for the missing message "Please Select" in State/Province dropdown selection.
On the country dropdown, the first thing you see in the selection box is "Please Select", as for the State/Province dropdown I observed the message "A Coruna" which is a the state of "Whatevetcountry". So I added 3 lines of code to show up the message "Please Select" instead which is more appropriate.
In the original version (2.2MS2) of the create_account.php page,
the "State" field is a text input box. After filling in the form, the
visitor is shown an error that the State field has been left empty,
even if they had put their state in there. They are then directed
back to the form, only this time, the "States" field is a drop menu
which it should have been in the first place.
This contribution modifies the original code on the create_account.php
page so that ALL the "states" in the zones table will display in a drop
menu when the customer first sees the create_account.php page.
Included in this download are an altered copy of create_account.php and an instruction file for manual installation.
Simple change to an already handy Mod. This shows an example having more than just US States.
To those wondering which file to modify, it is /catalog/create_account.php. Apologies for any confusion!
The attached zip file includes the file name.
This changes the default behavior of the customer signup form to show the states as a drop-down list and sets the default country to the United States. The country dropdown is configurable by using the ID code from the "countries" table in the db.
This was posted in a forum by bluepony, and I found it so valuable that I decided to post it as a contribution. All credit goes to him!
Here's the relevant post:
http://forums.oscommerce.com/index.php?showtopic=94671&view=findpost&p=375353