<form name="lloa" action="lotto2.php" method="post">
<p>LOTTO-ZAHLEN</p>
<p>
<input type="checkbox" name="zahl[]" value="1"> 1<br>
<input type="checkbox" name="zahl[]" value="2"> 2<br>
<input type="checkbox" name="zahl[]" value="3"> 3<br>
<input type="checkbox" name="zahl[]" value="4"> 4<br>
<input type="checkbox" name="zahl[]" value="5"> 5<br>
<input type="checkbox" name="zahl[]" value="6"> 6<br>
<input type="checkbox" name="zahl[]" value="7"> 7<br>
<input type="checkbox" name="zahl[]" value="8"> 8<br>
<input type="checkbox" name="zahl[]" value="9"> 9<br>
<input type="checkbox" name="zahl[]" value="10"> 10<br>
<input type="checkbox" name="zahl[]" value="11"> 11<br>
<input type="checkbox" name="zahl[]" value="12"> 12<br>
<input type="checkbox" name="zahl[]" value="13"> 13<br>
<input type="checkbox" name="zahl[]" value="14"> 14<br>
<input type="checkbox" name="zahl[]" value="15"> 15<br>
<input type="checkbox" name="zahl[]" value="16"> 16<br>
<input type="checkbox" name="zahl[]" value="17"> 17<br>
<input type="checkbox" name="zahl[]" value="18"> 18<br>
<input type="checkbox" name="zahl[]" value="19"> 19<br>
<input type="checkbox" name="zahl[]" value="20"> 20
</p>
<input type="submit" name="formaction" value="Auf gut Glück" />
</form>
<?php
if (isset($_POST['zahl'])) {
reset($_POST['zahl']);
foreach ($_POST['zahl'] as $v) {
print "$v ";
}
} else {
print "Da is was schief gegangen
.";
}
$db = @new mysqli('host', 'name', 'PW', 'DB');
if(mysqli_connect_errno()) {
die ('Connection Lost:'.mysqli_connect_error().'('.mysqli_connect_e rrno().')');
}
$sql ='INSERT INTO Lotto(z1,Datum) VALUES($v,NOW());';
$expo2 = $db->prepare($sql);
$expo2->execute();
$expo2->close();
unset($expo2);
?>