/** * function to get the towns for a given country * @param: $country */ function getTownsInCountry($country,$default) { //get the towns first $query=0; $query=mysqlquery("select distinct townID,town from vl_countries where lower(country)=lower('$country') and published=1 order by town"); if(mysqlnumrows($query)) { $return=0; $return="<select name=\"town\" id=\"town\" class=\"search\" onChange=\"selectother(this.form);\">"; if($default) { $return.="<option ".getTownID($default)." selected>$default</option>"; } else { $return.="<option selected>- select town -</option>"; } $q=array(); while($q=mysqlfetcharray($query)) { $return.="<option value=\"$q[townID]\">$q[town]</option>"; } $return.="<option value=\"Other\">Other</option>"; $return.="</select>"; } else { $return=0; $return="<input name=\"town\" type=\"text\" class=\"search\" id=\"town\" value=\"\" size=\"20\" maxlength=\"250\">"; } return $return; }
/** * function to get the towns for a given country * @param: $country */ function getCustomisedTownsInCountry($country,$default,$fieldName,$fieldID) { //get the towns first $query=0; $query=mysqlquery("select distinct townID,town from vl_countries where lower(country)=lower('$country') and published=1 order by town"); if(mysqlnumrows($query)) { $return=0; $return="<select name=\"$fieldName\" id=\"$fieldName\" class=\"search\" onChange=\"if((this.form).$fieldName.value=='Other') { loadInput('$fieldName','$fieldID','$default'); }\">"; if($default) { $return.="<option value=\"".(is_numeric($default)?$default:getTownID($default))."\" selected>".(is_numeric($default)?getTown($default):$default)."</option>"; } else { $return.="<option value=\"\" selected>- select ".removeSpecialCharacters((getTextAttributesInCountry("city",$country,0)?getTextAttributesInCountry("city",$country,0):"town"))." -</option>"; } $q=array(); while($q=mysqlfetcharray($query)) { $return.="<option value=\"$q[townID]\">".removeSpecialCharacters($q[town])."</option>"; } $return.="<option value=\"Other\">Other</option>"; $return.="</select>"; } else { $return=0; $return="<input name=\"$fieldName\" type=\"text\" class=\"search\" id=\"$fieldName\" value=\"\" size=\"25\" maxlength=\"250\">"; } return $return; }