Checkbox afhandeling
<h1>Checkbox afhandeling</h1>
<form method="post" action="checkbox2.php">
<input type="checkbox" name="keuze[]" value="Appel " />Waarde 1<br />
<input type="checkbox" name="keuze[]" value="Banaan " />Waarde 2<br />
<input type="checkbox" name="keuze[]" value="Druif " />Waarde 3<br />
<input type="submit" value="verzend" >
</form>
<!-- Voorbeeld 2 -->
<form method="post">
<?php
for ($i=1; $i <5 ; $i++)
{
echo''.$i.'<input type="checkbox" value="'.$i.'" name="checkbox[]"/></br>';
}
?>
<input type="submit" name="submit" class="form-control" value="Submit">
</form>
<?php
if(isset($_POST['submit']))
{
$check=implode(", ", $_POST['checkbox']);
print_r($check);
}
?>
<?
// Bron weergeven (dit haal je weg)
show_source(__FILE__);
?>