html and php or js select using query with relative field

Hi i have a customer and customer locations. When i select a customer i want to load the related customer location in another select. how can i do that using html and php

<div class="form-group">
<label for="customerID" class="col-sm-3 control-label">Customer</label>
<div class="col-sm-9">
<select class="form-control" name="customerName[]" id="customerName" onchange="getCustomerData()" >
<option value="">~~SELECT~~</option>
<?php
$customerSql = "SELECT * FROM customers WHERE transactionstatus='1' and companyid='1'";
$customerData = $connect->query($customerSql);

while($row = $customerData->fetch_array()) {                                            
echo "<option value='".$row['customerid']."' id='changeCustomer".$row['customerid']."'>".$row['customername']."</option>";
} // /while 

?>

</select>
</div>
</div> <!--/form-group-->             
<div class="form-group">