Hi!
i have a dynamic form
while ($row = mysql_fetch_object($resultall)) {
$ct++
...
$htmlr .= "<input type=hidden name=\"color_id[]\" value=\"$row->prod_color_id\">";
$htmlr .= '<td>$row->prod_color <input name="avail[]" type="checkbox" value="1" /></td>';
}
The form looks like this:
<save button>
Color Name1 <check box>
Color Name2 <check box>
...
...
<save button>
This is my update code
if($POST['update']){
for ($i=0; $i < $POST[ct]; $i++){
if($available[$i] == 1){
$sql = "INSERT INTO cds_prodavail_colors (prod_id, prod_color_id) VALUES($prod_id, $color_id[$i])";
}}}
the problem is the array avail will only be set if the check box if clicked, and so so my color_id array and avail array are not in sync. is there a way to rig the check box so that the avail array is set to 1 if its checked else if its not checked it stores some digit(except 1) in the avail array
I have to update the whole form with one submit button, if anybody has any input please let me know....thanks