Good night, I created 3 checkboxes and I made an array method so when I click on send it shows me the checkboxes selected with your value
, but this is not happening, I'm testing so that I put in my original form that I'm going to need to list my selected checkboxes ...
Can anyone help me?
html:
<html>
<head>
<title>Teste de checkbox</title>
</head>
<body>
<h1>Teste de check</h1>
<form method="post" action="form.php">
<input type="checkbox" name="cor" value="azul">
<input type="checkbox" name="cor" value="vermelho">
<input type="checkbox" name="cor" value="amarelo">
<input type="submit" name="olhar">
</form>
</body>
</html>
form.php:
<?php
if(isset($_POST["cor"])) {
for($i = 0; $i < count($_POST["cor"]); $i++) {
echo "a cor ".$_POST["cor"] [$i]." foi selecionada";
}
}
?>
Thank you ...