Add the following in your advanced search form to accomplish this. Requires having the postal code range search switch on, and databases loaded for the countries you need in this chained selector. The postal database must have the states in the same format as the articles have (can't abbreviate on one and not on the other).
<IF {SWITCH_ZIPRANGE}>
<script type="text/javascript">
function statefilter()
{
var thecountry = $("[name=countrysearch]").val();
$.post("{SUBDIRURL}/ajax.php",{ action: 'getstates', country: thecountry },
function(xml)
{
$("[name=statesearch]").html(xml);
});
}
function cityfilter()
{
var thestate = $("[name=statesearch]").val();
var thecountry = $("[name=countrysearch]").val();
$.post("{SUBDIRURL}/ajax.php",{ action: 'getcities', state: thestate, country: thecountry },
function(xml)
{
$("[name=citysearch]").html(xml);
});
}
</script>
<p>Filter to your desired location, starting with the country:</p>
<br >Country:
<input type="hidden" name="countrycondition" value="=" >
<select name="countrysearch" onchange="statefilter()"><option value=""></option>{COUNTRYOPS}</select>
<br >State/Territory:
<input type="hidden" name="statecondition" value="=" >
<select name="statesearch" onchange="cityfilter()"><option value=""></option></select>
<br >City:
<input type="hidden" name="citycondition" value="=" >
<select name="citysearch"><option value=""></option></select>
</IF>
<script type="text/javascript">
function statefilter()
{
var thecountry = $("[name=countrysearch]").val();
$.post("{SUBDIRURL}/ajax.php",{ action: 'getstates', country: thecountry },
function(xml)
{
$("[name=statesearch]").html(xml);
});
}
function cityfilter()
{
var thestate = $("[name=statesearch]").val();
var thecountry = $("[name=countrysearch]").val();
$.post("{SUBDIRURL}/ajax.php",{ action: 'getcities', state: thestate, country: thecountry },
function(xml)
{
$("[name=citysearch]").html(xml);
});
}
</script>
<p>Filter to your desired location, starting with the country:</p>
<br >Country:
<input type="hidden" name="countrycondition" value="=" >
<select name="countrysearch" onchange="statefilter()"><option value=""></option>{COUNTRYOPS}</select>
<br >State/Territory:
<input type="hidden" name="statecondition" value="=" >
<select name="statesearch" onchange="cityfilter()"><option value=""></option></select>
<br >City:
<input type="hidden" name="citycondition" value="=" >
<select name="citysearch"><option value=""></option></select>
</IF>