I have an HTML form that displays a list of pricing options called back from information from my database, I have created some functions to use this information as calculations to populate the rest of the form. Although I would like for the user to be able to change the values and the calculations to update with this but I can't seem to get that to work!
This is my HTML form code
<div class="form-group">
<label class="col-sm-2 control-label" for="totalprice">Total Price</label>
<input class="input" name="totalprice" type="text" id="totalprice" value="<?php echo $total_price; ?>">
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="rrp">RRP</label>
<input class="input" name="rrp" type="text" id="rrp" value="<?php echo $rrp_price; ?>">
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="delivery">Delivery</label>
<input class="input" name="delivery" type="text" id="delivery" value="<?php echo $delivery; ?>">
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="rfl">RFL</label>
<input class="input" name="rfl" type="text" id="rfl" value="<?php echo $rfl; ?>">
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="netprice">Nett Price</label>
<input class="input" name="netprice" type="text" id="netprice" value="<?php echo $net_price; ?>">
</div>
</div>
and this is my PHP code to get the values and do the calculations
$result = mysql_query("SELECT created_by, accessories, customer_ID, total_price, rrp FROM new_quote WHERE quote_ID = '$quote_ID'");
$data = mysql_fetch_row($result);
$sales_person = $data[0];
$accessories = $data[1];
$customer_ID = $data[2];
$total_price = str_replace('£', '', $data[3]);
$rrp_price = $data[4];
$rrp_price2 = preg_replace('/[^A-Za-z0-9\-]/', '', $rrp_price);
$rrp_price = substr($rrp_price2, 3);
$total_price2 = preg_replace('/[^A-Za-z0-9\-]/', '', $total_price);
$total_price = substr($total_price2, 3);
$rfl = $total_price - $rrp_price - $delivery - $care_products;
$net_price = ($total_price - $rfl) / 1.2;
$gr_profit = ($net_price * 0.11) + 500;
$po_profit = ($net_price * 0.03);