I'm trying to set a "price" of a product by its classification and wight, for example, I have 3 types of classifications GOOD, OK, and BAD each classification has a price range according to its weight; for example, classification (GOOD < 100 = $price1, > 100 = $price2, ) , (ok < 100 = $price1, >100 = $price2, )and (bad <100 = $price1, >100 = $price2, ) if the product is classified as GOOD and the wight of the product is < 100 its $price1 is 25 , but if the product is classified as GOOD but wight > its $price2 is 20,
My database looks like this: table name classification each table has three columns: name, price1, price2, (price1 is for <100)(price2 is for >100)
this is what I have so far :
product: <input id="product"name="product">
wight: <input id="wight" name="wight>
<label for="classifications"">classifications</label>
<div class="selector-classifications">
<select class="form-control" id="classifications"
name="classifications" required>
</select>
</div>
</div>
price: <input id="price" name="price">
the selector for classifications gets all the name of the classifications:
$fetch = "SELECT * FROM classification ";
$result = mysqli_query($con, $fetch) or die("error");
echo '<option value="0">choose option...</option>';
while (($fila = mysqli_fetch_array($result)) != NULL) {
echo '<option
value="'.$fila["name"].'">'.$fila["name"].'</option>';
}
my problem is that I'm trying to take the value of wight and classification to show its price in the price input without reloading the page, thanks in advance .