脚本宝典收集整理的这篇文章主要介绍了在php中添加删除按钮,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
但是我只是不确定如何做到这一点,我确实为每个表都有一个唯一的ID,所以我可以使用它作为id或者你怎么称呼它的按钮?
<?PHP //Start session //... all the connection stuff here $result = MysqL_query("SELECT * From feathermattresstopPErs"); echo "<table border='1'> <tr> <th>name</th> <th>old PRice</th> <th>price</th> <th>delete</th> </tr>"; while($row = MysqL_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['old_price'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "<td>"<!-- how Could I add a button here? -->"</td>"; echo "</tr>"; } echo "</table>"; ?>
任何帮助,将不胜感激.
<form action="" method="post">
echo '<td><input type="submIT" name="deleteitem" value="'.$row['id'].'" /></td>"';
<?PHP if(isset($_POST['deleteItem']) and is_numeric($_POST['deleteItem'])) { // here comes your delete query: use $_POST['deleteItem'] as your id // $delete = $_POST['deleteItem'] // $sql = "DELETE From `tablename` where `id` = '$delete'"; } ?>
以上是脚本宝典为你收集整理的在php中添加删除按钮全部内容,希望文章能够帮你解决在php中添加删除按钮所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。