$in_sale = 1; } else { $in_sale = 0; } if (isset($_POST['is_showed'])) { $is_showed = 1; } else { $is_showed = 0; } $id_category = 0; $good->saveData($_POST['name'], $_POST['price'], htmlspecialchars($_POST['review']), $_POST['size'], $_POST['color'], $img_link, $in_sale, $is_showed, $_POST['id_category']); header("Location: " . PATHSITE . "/admin-goods"); break; case "remove": $good = new Goods(); $good->deleteData("goods", $_POST['id_good']); header("Location: " . PATHSITE . "/admin-goods"); break; case "update": $good = new Goods(); $good->getGood($_POST['id_good']); if ($_FILES["img_link"]["name"] != '' & $_FILES["img_link"]["size"] < 1024 * 3 * 1024 & is_uploaded_file($_FILES["img_link"]["tmp_name"])) { move_uploaded_file($_FILES["img_link"]["tmp_name"], PATHSAVE . $_FILES["img_link"]["name"]); $img_link = $_FILES["img_link"]["name"]; } else { $img_link = $good->img_link; } $good->updateGood($_POST['id_good'], $_POST['name'], $_POST['price'], htmlspecialchars($_POST['review']), $_POST['size'], $_POST['color'], $img_link, $_POST['in_sale'], $_POST['is_showed'], $_POST['id_category']); header("Location: " . $_SERVER['HTTP_REFERER']); break; default: