PHP開發(fā)企業(yè)網(wǎng)站教程之刪除產(chǎn)品
點擊刪除,跳轉(zhuǎn)到delproduct.php頁面
下面我們就來看delproduct.php頁面的代碼:
<?php require_once('conn.php'); $id = $_GET['id']; $sql = "DELECT from product where id='$id'"; $res = mysql_query($sql); if($res){ echo "<script>alert('刪除產(chǎn)品成功');location.href='product.php'</script>"; }else{ echo "<script>alert('刪除產(chǎn)品失敗');location.href='product.php'</script>"; } ?>
獲取表單傳過來的參數(shù)id 然后根據(jù)id 進行刪除