Faced a problem: I can not correctly write the removal code for a row in the table via the checkbox .
The algorithm is as follows: I select the checkbox in the row, then click on the "delete" button and the record is deleted from the table.
The code for the checkbox is as follows:
in line
<td><input type="checkbox" name="abs[]" value="<?=$items[$key]['id'] ?>"></td> I create a checkbox array called abs , in value I assigned php code that defines the id string to know which line to remove.
Here is the code that I wrote, it does not work. Tell me how to properly make the row in the table deleted.
I have the following check: if there is an abs(checkbox) array and the argys button is argys , then the condition is met.
I have done everything on PDO php, and I do not understand how to change the request under the checkbox .
if(isset($_POST['argys']) and (isset($_POST['abs']))) { $id=$_POST['id']; $result=$dbh->prepare("DELETE FROM `Oke`.`tovars` WHERE `tovars`.`id` = :id;"); $result->bindParam(':id', $id); $result->execute(); }