I want to get a value from a drop-down menu (#city) and put it in onchange attribute of another drop-down menu (#type).
I'm try this but it can't work.
Code:<div> <label for="city">City<label> <select class="form-control" id="city" name="city" onchange="getTypo(this.value)"> <option value="">--Choose a city--</option> <?php $city = "SELECT DISTINCT `city` FROM `terrains` ORDER BY `city` "; $out = mysqli_query($db,$city); if (mysqli_num_rows($out) > 0) { while ($row = mysqli_fetch_assoc($out)) { ?><option value= <?php echo $row['city']?>><?php echo $row['city']?></option><?php } } ?> </select> </div> <div class="type"> <label for="type">Type<label> <select class="form-control" id="type" name="type" onchange="getSTD(this.value ,'~~~??')"> <option value="">--Choose a type--</option> </select> </div> </div>


Reply With Quote
