<div class="col-md-4">
<div class="form-group">
<label for="requesttype"><?php echo $requestField; ?></label>
<select class="form-control" required="" name="requesttype" onchange="fcrActionChange(this);">
<option value="">Select Request Type</option>
<option value="Inquiry">Inquiry</option>
<option value="Complaint">Complaint</option>
<option value="Service Request/FCR">Service Request/FCR</option>
<option value="Verification Call">Verification Call</option>
</select>
<span class="help-block"><?php echo $requestHelp; ?></span>
</div>
</div>
这是代码: 我想在其他下拉列表中获取值,如果选择查询然后在第二个下拉列表中选择的值是get,然后查询执行.cattype有四种类型,我想当用户从下拉列表中选择然后这将发生。有人帮助我在这方面。
<div class="col-md-4">
<div class="form-group">
<label for="catId"><?php echo $categoryField; ?></label>
<select class="form-control" name="catId">
<?php
$tcat = "SELECT catId, catName, catType FROM categories WHERE userId = ".$userId." AND isActive = 1 AND catType= ".$_GET['requesttype']." " ;
$rest = mysqli_query($mysqli, $tcat) or die('-2'.mysqli_error());
?>
<option value="..."><?php echo $selectOption; ?></option>
<?php while ($tcatrow = mysqli_fetch_assoc($rest)) { ?>
<option value="<?php echo $tcatrow['catId']; ?>"><?php echo clean($tcatrow['catName']); ?></option>
<?php } ?>
</select>
<span class="help-block"><?php echo $categoryHelp; ?></span>
</div>
</div>
答案 0 :(得分:0)
在第一个下拉列表的onchange事件中,使用ajax根据第一个下拉列表获取数据。然后填补另一个。