我正在尝试在两个不同的 div 中获取数据,但问题是当我在第二个 div 中选择 make 选项时,第二个 div 没有响应模型,它从第一个 div 中选择模型。如何格式化此代码.... .
<div id="col1">
<table width="20%" border="0" cellpadding="4" cellspacing="0" id="tbsrch-engine14">
<tr>
<td height="10">
<strong>Make:</strong>
</td>
<td>
<select name="make" id="make" style="width: 155px;" onChange="get_models(this.value,'<?php echo $base_url ?>ajaxResponse/get_models.php')">
<option value="0">Any</option>
<?php
$query = "SELECT id, name FROM tbl_make";
$result = mysql_query($query);
?>
<?php while ( $row = mysql_fetch_array($result)) {?>
<option value="<?php echo $row['id'].'-'.$row['name']?>">
<?php echo $row['name']?>
</option>
<?php }?>
</select>
</td>
</tr>
<tr>
<td height="40">
<strong>Model:</strong>
</td>
<td>
<div id="models">
<select name="model" id="model">
<option value="0">Any</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="col2">
<table width="100%" border="0" cellpadding="6" cellspacing="0" id="tbsrch-engine13">
<tbody>
<tr>
<td height="10px;">
<select name="make" id="make" style="width: 155px;" onChange="get_models(this.value,'<?php echo $base_url ?>ajaxResponse/get_models.php')">
<option value="0">Any</option>
<?php
$query = "SELECT id, name FROM tbl_make ";
$result = mysql_query($query); ?>
<?php while ( $row = mysql_fetch_array($result)) {?>
<option value="<?php echo $row['id'].'-'.$row['name']?>"><?php echo $row['name']?></option>
<?php }?>
</select>
</td>
</tr>
<tr>
<td>
<div id="models">
<select name="model" id="model">
<option value="0">Any</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
</div>