且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除按钮每个表行

更新时间:2023-02-07 08:13:44

让我们尝试和_GET,而不是_POST做到这一点。

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

在你的主code,你需要换线39(输入):

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

    echo  "<td>" . " <input type='submit' id= '$id' . ' value='Delete' >" .  "</td>";

    echo  "<td><a href='obrisi.php?id=$id'>Delete</a></td>";

在您obrisi.php变线3(ID设置):

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

    $id = $_POST['id'];

    $id = $_GET['id'];

最后作为一个很好的补充,由PHP标签结束前添加以下行的obrisi.php文件的末尾重定向回主画面。

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');

凡的index.php你主页的名称。

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