<?php include_once "../utils/product_util.php"; include_once "../../../controller/ProductController.php"; include_once "../../../controller/ProductImageController.php"; if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "addNew") { $name = $_REQUEST["name"]; $type = $_REQUEST["type"]; $sub_type = $_REQUEST["sub_type"]; $description = $_REQUEST["description"]; $description = str_replace("'", "", $description); $price = $_REQUEST["price"] * 1000; $promotion_id = $_REQUEST["promotion_id"]; $present_type = $_REQUEST["present_type"]; $result = ProductController::Add($name, $type, $sub_type, $price, $description, $promotion_id, $present_type); if ($result) { //create empty product image ProductImageController::Add($result, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); header("Location:../product_index.php?action=add&result={$result}"); //echo ProductUtil::createMessageBox("ADD PRODUCT","Add completed!"); } else { header("Location:../product_index.php?action=add&result=-1"); } } else { if (isset($_POST["btnUpdateProduct"])) { include_once "../../../controller/ProductController.php"; $id = $_REQUEST["id"]; $name = $_REQUEST["name"]; $type = $_REQUEST["type"]; $sub_type = $_REQUEST["sub_type"]; $description = $_REQUEST["description"];