I want to create a page where when a checkbox is checked, a message is printed, but if all checkbox is checked, print another message.
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>Form de exemplo com checkboxes</title>
<meta charset="utf-8">
</head>
<body>
<form action="" method="post">
<p>
<input type="checkbox" name="bike" value="on">eu tenho uma bike
</p>
<p>
<input type="checkbox" name="car" value="on">eu tenho um carro
</p>
<p>
<input type="submit" value="RLRLRLRL" />
</p>
</form>
</body>
</html>
<?PHP
#$_POST['bike'] = ( isset($_POST['bike']) ) ? true : null;
#$_POST['car'] = ( isset($_POST['car']) ) ? true : null;
#var_dump($_POST);
$bike = $_POST['bike'];
$car = $_POST['car'];
if($bike) {
echo "Olar, eu tenho uma bike";
} elseif ($car) {
echo "Olar, eu tenho um carro";
} elseif ($car || $bike) {
echo "Olar, eu tenho os dois";
}
?>