Adding product " . $_POST["name"] . " failed.
"; } else { echo "The product \"" . $_POST["name"] . "\" has been added to the product " . "catalogue. The product details are:" . "
Please fill in all of the add form
"; } } ?> Update product"; if (isset($_POST["updateSubmit"])) { if ((!empty($_POST["name"])) && (!empty($_POST["description"])) && (!empty($_POST["price"])) && (!empty($_POST["cost_price"])) && (!empty($_POST["stock"])) && (!empty($_POST["link"])) && (!empty($_POST["ean"]))) { $query = "UPDATE products " . "SET name = '" . $_POST["name"] . "', " . "description = '" . $_POST["description"] . "', " . "price = '" . $_POST["price"] . "', " . "cost_price = '" . $_POST["cost_price"] . "', " . "stock = " . $_POST["stock"] . ", " . "ean = '" . $_POST["ean"] . "', " . "link = '" . $_POST["link"] . "' " . "WHERE id=" . $_GET['id'] . ";"; $result = mysqli_query($connection, $query); if ($result == false) { echo "Updating product " . $_POST["name"] . " failed.
"; } else{ echo "The product \"" . $_POST["name"] . "\" has been updated in the " . "product catalogue. The new product details are:" . "
Please fill in all of the data requested in the form.
"; } } $query = "SELECT * FROM tbl_products WHERE id=" . $_GET["id"] . ";"; $result = mysqli_query($connection, $query); if ($result == false) { echo "Failed to find product details.
"; } else { $productDetails = mysqli_fetch_array($result, MYSQLI_ASSOC); if (empty($productDetails)) { echo "No product details were found.
"; } } ?> Getting product details failed."; } else { $productDetails = mysqli_fetch_array($result, MYSQLI_ASSOC); if (empty($productDetails)) { echo "The ID that you entered has not found anything, please try again.
"; } else { $query = "DELETE FROM tbl_products WHERE id=" . $_GET["id"] . ";"; $result = mysqli_query($connection, $query); if ($result == false) { echo "The product with id of " . $_GET["id"] . " (" . $productDetails["name"] . ") has not been deleted.
"; } else { echo "The product with id of " . $_GET["id"] . " (" . $productDetails["name"] . ") has been deleted.
"; } } } } ?>