Delete button for each table row

前端 未结 3 514
小蘑菇
小蘑菇 2021-01-13 21:18

I manage to succesfully read and display data from my database with the following code: http://pastebin.com/rjZfBWZX I also generate a delete button for each row of the tabl

3条回答
  •  无人及你
    2021-01-13 21:35

    Let's try and do it with _GET instead of _POST.

    In your main code you need to change line 39 (the input) from:

        echo  "" . " " .  "";
    

    to:

        echo  "Delete";
    

    In your obrisi.php change line 3 (the id setup) from:

        $id = $_POST['id'];
    

    to:

        $id = $_GET['id'];
    

    And finally as a nice addition, redirect back to the main page by adding the following line at the end of the obrisi.php file before the closing of the php tag.

        header('location:index.php');
    

    Where index.php the name of the main page you have.

提交回复
热议问题