This would happen before the submit, once the user changes the country field. Currently, we have this somewhat working using javascript. But since some browsers do not support javascript, we woud like to change it to php. Here is the current code (using javascript):
<script language="javascript">
function UpdateProvince(CountryName)
{
var combo = document.submit.yourprovince;
var item = document.createElement("option");
ClearProvinceList(combo,item);
// Update province list with valid values
if (CountryName.value == 'United States')
{
combo.options.add(item);
item.innerText = "Arizona";
item.value = "AZ";
}
}
function ClearProvinceList(combo, item)
{
var codesInList = combo.length
// Remove entries from the selectCodes Instance
for (i=0; i < codesInList; i++) {
combo.options[i] = null
}
// Add default entry
combo.options.add(item);
item.innerText = "Please select your province...";
item.value = "123";
item.selectedIndex=0;
}
</script>
<select name="yourcountry" onChange="UpdateProvince(window.document.submit.elements('yourcountry'))">
<OPTION VALUE="Please select your country..." SELECTED>Please select your country...
<OPTION VALUE="Afghanistan">Afghanistan
<OPTION VALUE="Albania">Albania
.
.
.
Thanks for your help,
Crystal