<?php
$totaal = calculateTotals();
$excl = round($totaal / 1.19, 2); $btw = $totaal - $excl;
?>
<form name="bestelling-plaatsen" method="post">
<label>verzendmethode</label>
<select name="verzendmethode" id="verzendmethode" onChange="recalc()">
<?php
// teller starten
$i = 0;
// loop uitvoeren
foreach($zend_opties as $value)
{
echo '<option value="'.$verzend_kosten[$i].'">'.$value.'</option>'; $i++;
}
?>
</select>
</form>
<table width="220px">
<tr><td><strong>Subtotaal</strong></td><td>€<span id="totaal"><?=$totaal?></span></td>
<tr><td><strong>BTW 19%</strong></td><td>€<span id="btw"><?=$btw?></span></td></tr>
<tr><td><strong>Excl. 19% BTW</strong></td><td>€<span id="excl"><?=$excl?></span></td></tr>
</table>
<script language="javascript">
function recalc(){
var totaal = <?=$totaal?>;
var btw = <?=$btw?>;
var excl = <?=$excl?>;
var verz = document.getElementById('verzendmethode').value;
var newTotaal = parseFloat(totaal) + parseFloat(verz);
document.getElementById('totaal').innerHTML = newTotaal;
document.getElementById('excl').innerHTML = (parseFloat(newTotaal) / 1.19);
document.getElementById('btw').innerHTML = (parseFloat(newTotaal) - document.getElementById('excl').innerHTML);
}
</script>