Hi,
I have some checkboxes on my form and am using the following code to populate it. The box will be checked if the user is allocated to the project. My problem is if I uncheck a checkbox and send the form I don't know what the $project_id is as it returns zero, so I cant delete the corresponding record, is there a way around this?
while($j < $num){ $project_id = mysql_result($result, $j, Project_ID); $project_name = mysql_result($result, $j, Project_Name); echo '<tr> <td height="30">'.$project_name.':</td> <td><input name="'.$project_id.'" type="hidden" value="0"> <input name="'.$project_id.'" type="checkbox" value="'.$project_id.'" '; $k = 0; while ($k < $num_elements){ if ($project_id == $project_id2[$k]){ echo 'checked'; } $k++; } echo '></td> </tr>'; $j++; }
No. Checkboxes *only* send information if they've been checked. You might want to consider using a radio input instead and forcing one to be defaulted (for a short list of options) or a select box (for a long list of options).
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php