Basically finished this simulation
This commit is contained in:
parent
12d8e33009
commit
3efca30a4c
4 changed files with 58 additions and 33 deletions
|
@ -2,6 +2,17 @@
|
|||
include "includes/security.php";
|
||||
|
||||
checkPost();
|
||||
|
||||
$_SESSION["nome"] = $_POST["nome"];
|
||||
|
||||
if (!isset($_COOKIE["votiFemminili"])) {
|
||||
setcookie("votiFemminili", 0, time() + 60 * 60 * 24 * 30);
|
||||
}
|
||||
|
||||
if (!isset($_COOKIE["votiMaschili"])) {
|
||||
setcookie("votiMaschili", 0, time() + 60 * 60 * 24 * 30);
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="it">
|
||||
|
@ -16,26 +27,23 @@ checkPost();
|
|||
<h1>Vota Atleti</h1>
|
||||
<h2>Ciao <?php echo $_SESSION["nome"] ?></h2>
|
||||
<form action="thanks.php" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="atleta" class="form-label">Atleta</label>
|
||||
<select class="form-select" name="atleta" id="atleta">
|
||||
<option value="1">Usain Bolt</option>
|
||||
<option value="2">Michael Phelps</option>
|
||||
<option value="3">Simone Biles</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="voto" class="form-label">Voto</label>
|
||||
<select class="form-select" name="voto" id="voto">
|
||||
<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>
|
||||
</div>
|
||||
<?php
|
||||
$nomi = [];
|
||||
if ($_POST["sesso"] == "m") {
|
||||
$nomi = ["Pellegrini", "Egonu", "Vio"];
|
||||
} else {
|
||||
$nomi = ["Totti", "Tamberi", "Rossi"];
|
||||
}
|
||||
|
||||
<button type="submit" class="btn btn-primary">Invia voto</button>
|
||||
foreach ($nomi as $nome) {
|
||||
echo '<div class="mb-3">';
|
||||
echo '<label for="voto_' . $nome . '" class="form-label">' . $nome . '</label>';
|
||||
echo '<input type="number" class="form-control" id="voto_' . $nome . '" name="voto_' . $nome . '" min="1" max="10">';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Invia voti</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue