I have a calculation that makes a total based on an exchange rate, sometimes I want this rate to change based on a checkbox.
So my calculation is
<?php
if (!empty($sum)) {
echo ceil($sum / $line['rate'] * 10) / 10.0;
$sum1 = ceil($sum / $line['rate'] * 10) / 10.0;
}
?>
then if my checkbox is ticked I want it to change to
<?php
if (!empty($sum)) {
echo ceil($sum / ($line['ask_rate']+.02) * 10) / 10.0;
$sum1 = ceil($sum / ($line['ask_rate']+.02) * 10) / 10.0;
}
?>
This is the checkbox and update button, ideally when the update button is pressed it sees if the checkbox is ticked and changes the calculation if it is.
<tr>
<td>Special Rate?</td>
<td><input type="checkbox" name="special" value="1"></td>
<td>Press Update</td>
<td><INPUT TYPE="SUBMIT" VALUE="update" NAME="B1"></form></td>
<tr>
The form submits to itself and totals up. But I'm having trouble working out how to make it happen.