Afficher un message
Vieux 07/09/2007, 12h33   #1
thomasriise
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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.

  Réponse avec citation
 
Page generated in 0,04799 seconds with 9 queries