Right now i got the code posted below.
It works alright, but it has 1 problem. When i press the submit button the form resets, but what i want is that the checkboxes which were checked remain checked and the values selected in the dropdown box keep that value.
How can you do this? Is it even possible with php or am i going to need js?
<?php
$verhuur = 60.00;
$Totaal = 0;
$Averhuur = "";
if (isset($_POST['Averhuur'])) {
$Averhuur = $_POST['Averhuur'];
}
if (isset($_POST['verhuur'])) {
$verhuur = $verhuur * $Averhuur;
$Totaal = $Totaal + $verhuur;
}
?>
<form action="test.php" method="post">
<table>
<tr>
<td> <input type="checkbox" name="verhuur" value="" /></td>
<td>Verhuur</td>
<td>€ 60,00</td>
<td>
<select name="Averhuur">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</td>
</tr>
<tr>
<td> </td>
<td><strong>Totaal:</strong></td>
<td>
<strong>
<?php
$formatnumber = number_format($Totaal, 2, ',', '');
echo "€ ";
if($Totaal!=0){
echo $formatnumber;
} else {
echo "0,00";
}
?>
</strong>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Bereken" /></td>
</tr>
</table>
</form>