php - 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>
解决方案
您可以考虑将值添加到重定向 URL 并在重定向页面中提取它们的选项。
所以而不是这个重定向:
redirect to www.example.com/afterdelete
你可以做
redirect to www.example.com/afterdelete?value1=1&value2=2
此选项既可以在服务器端完成,也可以在客户端完成。
您将需要您的afterDelete
页面来提取这些值并显示它们
推荐阅读
- c - 对文件中的单词进行索引的程序的分段错误
- c++ - 根据需要编译但不运行的热键/按钮(在 F5 和 Ctrl+Shift+B 之间)
- mysql - 将用户模型与自定义 mysql 表连接
- javascript - 使用 EaselJS 平移缩放行为
- twitterapi-python - Twitter API 地理位置
- url - JMeter 无法获取重定向 url
- javascript - 需要在 react native app 上实现 onPress 逻辑来处理两个任务
- javascript - 如何与其他组件共享 react-redux 连接组件中的功能?
- java - 如何获取 Java 类的真正模块依赖?
- python-3.x - 将 Excel 文件存储在烧瓶应用程序中,并在部署到 heroku 时使其可读