PHP開發(fā)企業(yè)網(wǎng)站教學刪除產(chǎ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 進行刪除