can you delete multiple rows using checkbox forms?
If so how, help please Im new to PHP.
thanks
delete multiple rows using checkbox forms
Moderator: General Moderators
-
new to php
- Forum Newbie
- Posts: 11
- Joined: Fri Nov 29, 2002 6:16 am
I tried to explain it here: viewtopic.php?t=4396
Maybe you find it helpful.
In short: If you have a form likeand it is sumbmitted to your php-script $_POST['todelete'] will be an array containing the values of all checked elements (and only of the checked elements).
You can iterate this array e.g. via
Maybe you find it helpful.
In short: If you have a form like
Code: Select all
<form method="POST" ... >
<input type="checkbox" name="todeleteї]" value="45" />record id 45<br/>
<input type="checkbox" name="todeleteї]" value="46" />record id 46<br/>
<input type="checkbox" name="todeleteї]" value="50" />record id 50<br/>
<input type="checkbox" name="todeleteї]" value="55" />record id 55<br/>
<input type="checkbox" name="todeleteї]" value="78" />record id 78<br/>
<input type="submit" />
</form>You can iterate this array e.g. via
Code: Select all
foreach($_POSTї'todelete'] as $id)
myDeleteRecordById($id); // what ever this function does