<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Check box procedure</title>
</head>
<body>
<h1>Check box procedure</h1>
<form action="checkbox.php" method="post">
<input type="checkbox" name="cbp[]" value="Beer" />Beer<br>
<input type="checkbox" name="cbp[]" value="Wine" />Wine<br>
<input type="checkbox" name="cbp[]" value="Whiskey" />Whiskey<br>
<input type="checkbox" name="cbp[]" value="Soda" />Soda<br>
<input type="checkbox" name="cbp[]" value="Ice" />Ice<br>
<input type="submit" name="submit" value="Submit" />
</form>
<?php
if(isset($_POST["submit"])) {
echo "<b>You have selected:</b><br>";
$choices = array();
$choices = $_POST["cbp"];
foreach($choices as $value) {
echo $value."<br>";
}
}
?>
</body>
</html>
|