Hi, what options do I have for getting my form handler to return the values of checkboxes that are not checked rather than those that are? What would be the simplest option? I can imagine setting it up to include a ‘hidden’ array that holds all the line items, and then using array_diff to compare it to those line items that the user checks off to get rid of. But this approach doesn’t work in my larger code scheme. Any suggestions for other options?
<html><body>
<form name=”myName” form method=”POST” action=”checkbox.php”>
<input type=”submit” value=”Remove”>
<br />
<?php
//while ($line1 = mysql_fetch_array($myArray, MYSQL_ASSOC)){
//Data actually comes from a mysql query
$myArray=array(cat,dog,horse,bird,cow,mouse,pony,rat,bug,bat);
foreach ($myArray as $value) {
?>
<input type=’checkbox’ name= ‘checkNum[]’ value='<?php echo($value);?>’>
<?php
print_r($value);
?>
<br />
<?php
}
//}
?>
</form></body></html>
<html>
<body>
<!–So…if the first three elements are checked….–>
File name=checkbox.php
<?php
$checked=$_POST[‘checkNum’];
$imploded= implode(“…”, $checked);
//what I don’t want is this printout
echo “<br><br>$imploded”; //prints cat…dog…horse
//what I do want is this printout”;
echo “<br><br>bird…cow…mouse…pony…rat…bug…bat”;
?>
</body>
</html>
Thanks!