Forum Moderators: open

Message Too Old, No Replies

Checkboxes For Each Row To Update Or Delete In Bulk

         

jbearnolimits

3:28 am on Oct 18, 2022 (gmt 0)

Top Contributors Of The Month



I have multiple rows showing information for multiple people. Each one has a different id. What I want to do is make each row have a checkbox so I can select which rows I want to update or delete. The question is how do I write the query if the form sends multiple id's to update (without knowing how many rows or what id's will be checked)?

MichaelBluejay

1:43 am on Nov 3, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think you mean something like this:

<form action=delete.php method=post>
<table>
<tr><td>Delete?</td><td>FRUIT</td></tr>
<tr><td><input name=row1 type=checkbox></td>APPLES</td></tr>
<tr><td><input name=row2 type=checkbox></td>BANANAS</td></tr>
<tr><td><input name=row3 type=checkbox></td>CHERRIES</td></tr>
</table>
<input type=submit value=submit>
</form>


From there your PHP (or Python, or Perl) script will receive the names of the fields that have been checked and can just count how many field values were received that start with "row".

Is that what you mean?