Php oop product management product delete
From w3cyberlearnings
Contents |
Objective
Create a delete page to delete product based on the product id.
delete.php
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Delete</title> </head> <body> <?php require_once 'product.php'; if (isset($_REQUEST['id'])) { $product = new product(); $product->id = $_REQUEST['id']; // get product for display later $product_infor = $product->get_product_by_id(); if ($product->delete_db()) { echo '<h3>Successfully deleted:'; echo $product_infor[0]['pname'] . '</h3>'; } else { echo '<h3>Error delete product info</h3>'; } } require_once 'menu.php'; ?> </body> </html>