electricphp
Programmer
I had this script that was working fine on the development server and when I moved it to the new server it stopped working. I don't even know how to begin to debug this.
Normally when you select a county the town1 select box gets populated, but on the new server when you select a county nothing happens.
data1.php:
please help
Normally when you select a county the town1 select box gets populated, but on the new server when you select a county nothing happens.
Code:
<script type="text/javascript" charset="utf-8">
$(function(){
$("select#county1").change(function(){
$.getJSON("data1.php",{act: 'getTown', county1: $(this).val()}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("select#town1").php(options);
})
})
})
</script>
<option selected="selected">Select County</option>
<?php do { ?>
<option>
<?= $row_stat['county']; ?>
</option>
<?php } while ($row_stat= mysql_fetch_assoc($stat)); ?>
</select>
<select name="town1" id="town1"></select>
data1.php:
Code:
include("include/init.php");
if ($_GET['act']=='getTown') {
$query_state = sprintf("SELECT * FROM zip1 WHERE county = '%s' GROUP BY city ORDER BY city ASC", $_GET['county1']);
$state = mysql_query($query_state) or die(mysql_error() ." " .$query_state);
$row_state = mysql_fetch_assoc($state);
do {
$options[] = "{optionValue:'".$row_state['city']."', optionDisplay: '".phpentities(trim($row_state['city'])) ."'}";
} while ($row_state = mysql_fetch_assoc($state));
$theOptions = implode(",", $options);
$theOptions = "[".$theOptions."]";
echo $theOptions;
}
?>
please help