echo "<input type=\"hidden\" name=\"sort_by\" id=\"sort_by\" class=\"hidden\" value=\"" . $sort_by . "\" /> \n"; echo "<input type=\"hidden\" name=\"search\" id=\"search\" class=\"hidden\" value=\"" . $search_parameter . "-" . $search_value . "\" /> \n"; /* -- BUTTON RESET -- */ if (empty($search_parameter)) { $reset = "hidden"; } else { $reset = ""; } /* --- BUTTON HANDLER --- */ if (isset($_POST['btn-voucher-index']) && $_POST['btn-voucher-index'] == 'GO') { $type_id = $_POST['type_id']; $action = filter_var($_POST['option-action'], FILTER_SANITIZE_STRING); if ($action == 'delete') { foreach ($type_id as $type_id) { $type_id = filter_var($type_id, FILTER_SANITIZE_NUMBER_INT); $count_used = $_get->count_voucher_use($type_id); if ($count_used->rows > 0) { $type = 'danger'; $msg = 'Cannot delete voucher because it has been used for one or more order(s)'; } else { $type = 'success'; $msg = 'Success deleted voucher'; } $_update->delete_voucher($type_id); } } else { if ($action == 'change') { foreach ($type_id as $type_id) { $type_id = filter_var($_POST['type_id'], FILTER_SANITIZE_NUMBER_INT); $count_status = $_get->count_voucher_valid($type_id, 1); $arr_check = array();