I have an invoice in a HTML table. You select item name then item lot and the item #. There is a check box at the end to mark if it is sold out.
<input type="checkbox" name="soldout[]">
When I process the form the $_POST array of check boxes obviously don't contain the unchecked boxes. That leads me to problems when matching up the check boxes to the item
foreach($productID as $key=>$id){
$p = $id;
if(isset($soldout[$key])){
$so = true;
}
}
So if I have three line items and the first and last are marked sold out it processes as the first 2 sold out and the last one not sold out.
I don't think i can do this:
<input type="checkbox" name="soldout[<?php echo $i; ?>]">
because I am adding empty invoice lines with javascript when needed and wouldn't know how to increment the array key.
Any ideas on how to handle this?
productIDas well? If so, and if they are unique per row, I'd use theproductIDas a key tosoldout[], i.e.soldout[<?php echo $productId; ?>]. Obviously, with JavaScript, you'd have to analyze the newly created row for itsproductIDthen, and add is as a key to the checkbox name.