I have added a checkbox to a form that the user can dynamically add rows to. You can see the form here.
I use an array to pass the values for each row to a PHP emai
To get checked and unchecked both values in POST place a hidden field with exactly the same name but with opposite value as compared to the original chkbox value such that in this case the value will be '0'
$val) {
//echo "KEY::".$key."VALue::".$val."
";
if($val == '1') { //replace '1' with the value you want to search
$found[] = $key;
}
}
foreach($found as $kev_f => $val_f) {
unset($chk_name[$val_f-1]); //unset the index of un-necessary values in array
}
final_arr = array(); //create the final array
return $final_arr = array_values($chk_name); //sort the resulting array again
}
$chkox_arr = getAllChkboxValues($_POST['chk_name']); //Chkbox Values
echo"";
print_r($chkox_arr);
?>