P粉9767371012023-08-23 09:35:07
使用javascript
<input name="Submit2" type="button" class="button" onclick="javascript:location.href='delete.php?id=<?php echo $your_id;?>';" value="« 返回" />
在delete.php中
$id=$_GET['id'];
並將$id放入你的sql語句中。
P粉2897750432023-08-23 09:15:04
您必須在刪除連結中傳遞一個變數。您必須在隱藏欄位中傳遞<?php echo $contact['name']; ?>
(name
值)或將此值傳遞給URL
:
替換為
<td class="contact-delete"> <form action='delete.php' method="post"> <input type="hidden" name="name" value=""> <input type="submit" name="submit" value="Delete"> </form> </td>
使用
<td class="contact-delete"> <form action='delete.php?name="<?php echo $contact['name']; ?>"' method="post"> <input type="hidden" name="name" value="<?php echo $contact['name']; ?>"> <input type="submit" name="submit" value="Delete"> </form> </td>