Reply to parse empty checkbox to php

Your name:

Reply:


Posted by thomasriise on 09/07/07 12:30

Hi Guys,

I have this code:


---
<?php

echo '<html><head><title>checkbox tester</title></head>';

if ($submit){

foreach (($fruit = $_REQUEST["fruit"]) as $fruitid ) {

if ($fruitid == "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 (empty($_REQUEST["fruit"])){
$fruit = 'notchecked';
}

echo '</form></body><html>';
---

Only the checked boxes gets parsed to php - how do I get the UNchecked
boxes?

Thanks!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация