很抱歉,如果之前已经讨论过,但是基于我的观察和试验。所有这些都不起作用。我有5个下拉菜单,它们是品牌,型号,颜色,引擎号。和chasis no。。我应该使用什么javascript函数,来制作依赖于所选品牌的模型的下拉列表,颜色的下拉取决于所选模型和下拉引擎号。并且chasis no取决于所选择的颜色。
这是我的代码
<label for="bName" class="control-label col-xs-4"><p class="left">Brand</p></label>
<div class="col-xs-7">
<div class="req">
<?php
include_once "config.php";
$bsql="SELECT bName, brandID FROM brand order by bName";
$bstmt=$con->prepare($bsql);
$bstmt->execute();
$bstmt->bind_result($bName, $bid);
$bstmt->store_result();
echo "<select name='brandID' class='form-control'>
<option value=''></option>";
while ($bstmt->fetch()){
echo '<option value="'.$bid.'">'.$bName.'</option>';
}
echo '</select>';
?>
</div>
<div class="col-xs-1">
</div>
</div>
</div>
<div class="form-group">
<label for="model" class="control-label col-xs-4"><p class="left">Model</p></label>
<div class="col-xs-7">
<div class="req">
<?php
include_once "config.php";
$msql="SELECT model, modID FROM model where brandID=? order by model";
$mstmt=$con->prepare($msql);
$mstmt->bind_param('i', $bid)
$mstmt->execute();
$mstmt->bind_result($model, $mid);
$mstmt->store_result();
echo "<select name='mID' class='form-control'>
<option value=''></option>";
while ($mstmt->fetch()){ echo '<option value="'.$mid.'">'.$model.'</option>';
}
echo '</select>';
?>
</div>
<div class="col-xs-1">
</div>
</div>
</div>
<div class="form-group">
<label for="color" class="control-label col-xs-4"><p class="left">Color</p></label>
<div class="col-xs-7">
<select ="color" class="req">
<option value='blue'>Blue</option>
<option value='red'>Red</option>
</select>
</div>
<div class="col-xs-1">
</div>
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label for="engine" class="control-label col-xs-4"><p class="left">Engine No.</p></label>
<div class="col-xs-7">
<select name="engine" class="req" required/>
<option></option>
</select>
</div>
<div class="col-xs-1">
</div>
</div>
<div class="form-group">
<label for="chasis" class="control-label col-xs-4"><p class="left">Chasis No.</p></label>
<div class="col-xs-7">
<select name="chasis" class="req" required/>
<option></option>
</select>
</div>
<div class="col-xs-1">
</div>
</div>
</div>
</div>
&#13;