在那里我有3 select input type
我想让它相互关联。
在这里我的观点:
<div class="form-group">
<label for="">Location</label>
<!-- <input id="geocomplete" type="text" name="location" placeholder="Type in an address" class="form-control" /> -->
<select name='locations' class="form-control" id="map" required>
<option value='' >- Location -</option>
<?php
$zone = DB::table("zone")->get();
foreach($zone as $zones) {
echo "<option value='$zones->id'>$zones->zone</option>";
}
?>
</select>
</div>
<div class="form-group">
<label for="">Location</label>
<!-- <input id="geocomplete" type="text" name="location" placeholder="Type in an address" class="form-control" /> -->
<select name='location' class="form-control" id="map" required>
<option value='' >- Location -</option>
<?php
$zonets = DB::table("zonets")->get();
foreach($zonets as $zonetss) {
if($zonetss->id_zone == $zone->id){
echo "<option value='$zonetss->id'>$zonetss->location</option>";
}
}
?>
</select>
</div>
<div class="form-group">
<label for="">Location</label>
<!-- <input id="geocomplete" type="text" name="location" placeholder="Type in an address" class="form-control" /> -->
<select name='location_1' class="form-control" id="map" required>
<option value='' >- Location -</option>
<?php
$airport = DB::table("airport")->get();
foreach($airport as $airports) {
echo "<option value='$airports->id'>$airports->loc_airport</option>";
}
?>
</select>
</div>
这是我的表:
在那里我想让选择相关。
例如:
在select = zone
中我选择Jakarta(id = 3)
然后我想make zonets
只显示id_zone = 3
之后与zonets
相同,airport
仅显示数据id_zonets
与zonets
相同的数据,我选择它。
我希望有人可以帮助我,让我的脚本正常工作..