I wanted that when the user will choose which brand the model choices will also show by brand. My question is how can I get the model name base on the chosen brand when It won't show because I needed the response from the first one.
<div class="col-sm">
<form class="needs-validation" method="post" novalidate>
<div class="form-row">
<div class="col-md-6 mb-10">
<label for="validationCustom03">Select Brand</label>
<select class="form-control custom-select" name="brandname" required>
<option value="">Select Brand</option>
<?php
$ret=mysqli_query($con,"select brandName from tbl_brand");
while($row=mysqli_fetch_array($ret))
{?>
<option value="<?php echo $row['brandName'];?>" ><?php echo $brandnameSelect = $row['brandName'];?></option>
<?php } ?>
</select>
<div class="invalid-feedback">Please select Item.</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6 mb-10">
<label for="validationCustom03">Model</label>
<select class="form-control custom-select" name="modelname" required>
<option value="">Select Model</option>
<?php
$ret=mysqli_query($con,"select modelName from tbl_model WHERE brandID='$brandnameSelect'");
while($row=mysqli_fetch_array($ret))
{?>
<option value="<?php echo $row['modelName'];?>" ><?php echo $row['modelName'];?></option>
<?php } ?>
</select>
<div class="invalid-feedback">Please select Item.</div>
</div>
</div>
<div class="form-row">
<div class="col-md-6 mb-10">
<label for="validationCustom03">Item Name</label>
<input type="text" class="form-control" id="validationCustom03" placeholder="Brand Name" name="brandname" required>
<div class="invalid-feedback">Please provide a valid item name.</div>
</div>
</div>
<button class="btn btn-primary" type="submit" name="submit">Submit</button>
</form>
</div>
</div> ```