parse unchecked checkboxes to php
Hi Guys,
I have this code:
---
<?php
echo '<html><head><title>checkbox tester</title></head>';
if ($submit){
foreach (($fruit = $_REQUEST["fruit"]) as $fruitid ) {
if ($day_id == "notcheched") {
echo 'This fruit was <b>NOT</b> checked: '.$fruitid.'<br />';
} else {
echo 'This fruit WAS checked: '.$fruitid.'<br />';
}
}
echo '-------------------------------------<br />';
}
echo '
<form method="post" action="checker.php">
Choose a fruit:<br><br>
<input type="checkbox" name="fruit[]" value="apples">apples <br>
<input type="checkbox" name="fruit[]" value="oranges">oranges <br>
<input type="checkbox" name="fruit[]" value="peaches">peaches <br>
<input type="checkbox" name="fruit[]" value="mangos">mangos<br>
<input type="submit" name="submit">
';
if ($fruit = null){
$fruit = notchecked;
}
echo '</form></body><html>';
---
The above code only outputs the checked fruits - not the unchecked -
how can I make it print the unchecked also?
Thanks in advance.
|