I need to pass the value and a couple of other values depending on what checkboxes are checked. I found posted a couple of other times here to rely on html for this and pass a hidden value before the checkbox :
<input type="hidden" value="0" name="B_1" />
<input type="checkbox" value="1" name="B_1" />
<input type="hidden" value="0" name="B_2" />
<input type="checkbox" value="1" name="B_2" />
<input type="hidden" value="0" name="B_3" />
<input type="checkbox" value="1" name="B_3" />
Then in the php I am making different associations based on these checkboxes :
$b = "Buyers";
$bv1 = "Not a web item";
$bv2 = "Need sample";
$bv3 = "Sample not available";
if ($_POST['B_1']) { $b1 = array( $b , $bv1 , $_POST['B_1'] ); }
if ($_POST['B_2']) { $b2 = array( $b , $bv2 , $_POST['B_2'] ); }
if ($_POST['B_3']) { $b3 = array( $b , $bv3 , $_POST['B_3'] ); }
when I use print_r
I am only seeing the arrays for those boxes I checked :
Array ( [0] => Buyers [1] => Not a web item [2] => 1 )
I expect to see all of the arrays returned regardless of state of checkbox.
Array ( [0] => Buyers [1] => Not a web item [2] => 0 )
Array ( [0] => Buyers [1] => Need sample [2] => 1 )
Array ( [0] => Buyers [1] => Sample not available [2] => 0 )