0) { // Redirect to the edit product page header("Location: edit_product.php?id=" . $id . "&Keys=" . $keys . "&Page=" . $page . ($category_id ? "&category_id=" . $category_id : "")); exit(); } } // Handle bulk actions if ($act == 'postchk') { if (isset($_POST['chkbox']) && isset($_POST['chkact'])) { $chk_ids = array_map('intval', $_POST['chkbox']); $chk_act = (int)$_POST['chkact']; if (!empty($chk_ids)) { $ids_str = implode(',', $chk_ids); switch ($chk_act) { case 0: case 1: $sql = "UPDATE customer SET cs_state = " . $chk_act . " WHERE id IN (" . $ids_str . ")"; break; case -1: $sql = "DELETE FROM products WHERE id IN (" . $ids_str . ")"; break; } if (isset($sql)) { mysqli_query($conn, $sql); } } header("Location: ?Keys=" . $keys . "&Page=" . $page . ($category_id ? "&category_id=" . $category_id : "")); exit(); } } ?>