/* -- DATABASE ACTION -- */ if (isset($_POST['btn-index-shipping']) and $_POST['btn-index-shipping'] == 'GO') { $courier_id = $_POST['courier_id']; if ($_POST['ship-action'] == "delete") { if (in_array('1', $courier_id)) { $type = 'danger'; $msg = "Can't delete mandatory courier"; } else { foreach ($courier_id as $courier_id) { $courier_id = filter_var($courier_id, FILTER_SANITIZE_NUMBER_INT); $_update->deleteCourier($courier_id); $_update->deleteCourierRste($courier_id); } $type = 'success'; $msg = 'Item(s) has been successfully deleted'; } } else { if ($_POST['ship-action'] == "status") { foreach ($courier_id as $courier_id) { $courier_id = filter_var($courier_id, FILTER_SANITIZE_NUMBER_INT); $active_status = filter_var($_POST['ship-option'], FILTER_SANITIZE_STRING); $_update->updateCourier($active_status, $courier_id); $type = 'success'; $msg = 'Changes successfully saved'; } } } $page = 'self'; set_alert($type, $msg); safe_redirect($page); }