mirror of
https://github.com/FlyInTheBox/31TSAI.git
synced 2024-11-09 20:44:11 +01:00
l
This commit is contained in:
parent
288c09d171
commit
51dc25d05b
1 changed files with 6 additions and 6 deletions
|
@ -13,8 +13,10 @@
|
||||||
<legend>Liczby</legend>
|
<legend>Liczby</legend>
|
||||||
<?PHP
|
<?PHP
|
||||||
$arr = range(0, 100, 10);
|
$arr = range(0, 100, 10);
|
||||||
|
|
||||||
foreach ($arr as $value) {
|
foreach ($arr as $value) {
|
||||||
echo '<label for="check"><input type="checkbox" name="check[]" value="' . $value . '" id="box' . $value . '">' . $value . '</label>';
|
$checked = (!empty($_POST['check']) && in_array($value, $_POST['check'])) ? 'checked':'';
|
||||||
|
echo '<label for="check"><input type="checkbox" name="check[]" value="' . $value . '" id="box' . $value . '" '.$checked.'>' . $value . '</label>';
|
||||||
}
|
}
|
||||||
echo '<br><button type="submit">Wyślij</button>';
|
echo '<br><button type="submit">Wyślij</button>';
|
||||||
?>
|
?>
|
||||||
|
@ -23,11 +25,9 @@
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
if (empty($_POST['check'])) {
|
if (empty($_POST['check'])) {
|
||||||
echo 'Nie wybrano żadnych liczb.';
|
echo 'Nie wybrano żadnych liczb.';
|
||||||
} else {
|
}
|
||||||
echo 'Wybrano liczby: ';
|
else {
|
||||||
foreach ($_POST['check'] as $value) {
|
echo 'Wybrano liczby: '.implode(', ',$_POST['check']).'.';
|
||||||
echo $value . ', ';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue