$img_link = $_FILES["img_link"]["name"]; } else { $img_link = ''; } if (isset($_POST['in_sale'])) { $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;