<html>
<body>
<?php
if ($_POST ['submitted'] == "yes") {
if (count ( $_POST ['fruit'] ) != 0) {
echo "Your Selections:<br />";
} else {
echo "You have not made any selections.<br /><br />";
}
for($i = 0; $i < count ( $_POST ['fruit'] ); $i ++) {
echo $_POST ['fruit'] [$i] . "<br />";
}
?><a href="index.php">Try Again</a><?php
}
if ($_POST ['submitted'] != "yes") {
?>
<form action="index.php" method="post">
<input type="hidden" name="submitted" value="yes" /> Your Choice (s): <br />
<select name="fruit[]" multiple="multiple">
<option value="Bananas">Bananas</option>
<option value="Apples">Apples</option>
<option value="Oranges">Oranges</option>
</select><br />
<input type="submit" value="Submit" /></form>
<?php
}
?>
</body>
</html>
|