Created
January 5, 2018 20:13
-
-
Save riandesign/99ca1556377b6fdd31478c9f74e06765 to your computer and use it in GitHub Desktop.
checkbox.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<?php | |
if ($_SERVER['REQUEST_METHOD'] === 'POST') : | |
if (!isset($_POST['tarefas'])) { | |
echo'Nenhuma tarefa feita.'; | |
} else { | |
echo 'Tarefas feitas:'; | |
echo '<ul>'; | |
foreach ($_POST['tarefas'] as $tarefa) { | |
echo '<li>' . $tarefa . '</li>'; | |
} | |
echo '</ul>'; | |
} | |
else : | |
?> | |
<form action="" method="post"> | |
<input type="checkbox" name="tarefas[]" value="Caminhar">Caminhar<br> | |
<input type="checkbox" name="tarefas[]" value="Ir ao banco">Ir ao banco<br> | |
<input type="checkbox" name="tarefas[]" value="Ligar para escola">Ligar para escola<br> | |
<input type="checkbox" name="tarefas[]" value="Cancelar TV a cabo">Cancelar TV a cabo | |
<br> | |
<input type="submit"> | |
</form> | |
<?php | |
endif; | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment