} } if (isset($_POST['btn-detail-collection']) && $_POST['btn-detail-collection'] == 'Save Changes') { $collection_id = $color_detail->collection_id; $visibility = filter_var($_POST['visibility'], FILTER_SANITIZE_STRING); $name = filter_var($_POST['name'], FILTER_SANITIZE_STRING); $description = filter_var($_POST['description'], FILTER_SANITIZE_STRING); $check_name = $_get->count_name($name, $collection_id); if ($check_name->rows > 0) { $page = 'self'; $type = 'danger'; $msg = $name . ' has already existed, please choose another collection name'; set_alert($type, $msg); safe_redirect($page); } $_update->update($name, $description, 'active', $visibility, $collection_id); $page = 'detail-collection/' . $collection_id . '/' . cleanurl($name); $type = 'success'; $msg = 'Changes successfuly saved'; set_alert($type, $msg); safe_redirect($page); } if (isset($_POST['btn-detail-collection']) && $_POST['btn-detail-collection'] == 'Delete') { $check = $_get->count_products($color_id); if ($check->rows > 0) { $page = 'detail-collection/' . $color_id . '/' . cleanurl($color_detail->collection_name); $type = 'danger'; $msg = "Can't delete because it contains one or more items."; set_alert($type, $msg); safe_redirect($page); } else {