首页 > 解决方案 > Display Values of a row after delete

问题描述

I have a delete button in my site that deletes a row in a table.

After the row is deleted, the user is redirect to another page.

Is it possible to display the deleted row values in the redirected page? thank you!

        <table class="table table-striped b-t b-light">
        <thead>
            <tr>

                <th style="text-align: center">User Name</th>
                 <th style="text-align: center">User Last Name</th>
                 <th style="text-align: center">Email</th>
                  <th style="text-align: center">Password</th>
                   <th style="text-align: center">User Type</th>
                    <th style="text-align: center">Edit</th>
                    <th style="text-align: center">Delete</th>
            </tr>
        </thead>
          <?php foreach ($ulistq as $urule) : ?>
        <tbody>

        <th style="text-align: center"><?= $urule['u_name'] ?></th>
        <th style="text-align: center"><?= $urule['u_lastname'] ?></th>
        <th style="text-align: center"><?= $urule['u_email'] ?></th>
        <th style="text-align: center"><?= $urule['u_password'] ?></th>
        <th style="text-align: center"><?= $urule['u_rule'] ?></th>
        <td style="text-align: center"> <a href="useredit.php?eid=<?= $urule['id'] ?>" class="btn btn-sm btn-info active">Edit</a> </td>
          <td style="text-align: center"> <a href="userdel.php?eid=<?= $urule['id'] ?>" class="btn btn-sm btn-info active">Delete</a> </td> 
        </tbody>
           <?php endforeach; ?>
    </table> 

标签: phpmysqlmysqli

解决方案


您可以考虑将值添加到重定向 URL 并在重定向页面中提取它们的选项。

所以而不是这个重定向:

redirect to www.example.com/afterdelete

你可以做

redirect to www.example.com/afterdelete?value1=1&value2=2

此选项既可以在服务器端完成,也可以在客户端完成。

您将需要您的afterDelete页面来提取这些值并显示它们


推荐阅读