Hope you can follow this. In one script I retrieve the rows and display them. Instead of a checkbox next to each row I have a combo box below that lists the row numbers. This works well if you only have 2-5 rows. The user sees and selects the row number(s) they want to delete. The value of each displayed row number is actually the unique id number of that particular row. The selected row values are passed to the next script.
+++++++++++++++++ First script snippet ++++++++++++++++++++
for ($i=0; $i<$num; $i++){
$arr = pg_fetch_array($result, $i);
$d_counsel_id=$arr["d_counsel_id"];
if ($i == 0) { / Build an array of the counsel_id numbers /
$c_id = array($d_counsel_id);
}
else {
array_push ($c_id, $d_counsel_id);
}
print("<table width=620 border=1>\n");
print("<tr align=left>\n");
printf("<td width=20><font size=4>%s</font></td>\n", $i+1);
printf("<td width=300><font size=4>Name (Last, First) and Phone - <br> %s</font></td>\n", $arr["d_counsel"]);
printf("<td width=300><font size=4>Firm - <br> %s</font></td>\n", $arr["d_counsel_firm"]);
print("</tr></table>\n");
if ($i == $num-1) { /* Display the counsel_id numbers */
print("<table width=600 border=1><tr align=center><td>\n");
print("<select name=\"c_id[]\" multiple size=$num>\n");
for($j=0; $j<$num; $j++) {
printf("<option value=\"%s\">%s</option>\n", $c_id[$j], $j+1);
}
print("</select></td>\n");
print("<td><font size=3 color=703030>Hold the Control key down, click on the counsel number(s) you want to delete.</font></td></tr></table>\n");
printf("<input type=hidden name=c_function value=\"%s\">\n", $c_function);
}
} / end for loop /
++++++++++++++++++++++++++++++++++++++++++++++++++++
In the second script which receives the id numbers, I count how many I received and then build multiple delete statements--one per id number that was passed.
++++++++++++++ Second script snippet +++++++++++++++++++++
if ($c_function == "delete"){
$items = count($c_id);
for($i=0; $i<$items; $i++){
$d_counsel_id = $c_id[$i];
$process_stmt = $process_stmt . "delete from deft_counsel where d_counsel_id = $d_counsel_id;";
}
}
I might have an example of this with checkboxes, too. I'll have a look.
Hank