$action = 'insert'; } else { $class_pb->update($brand_id, $sda); $action = 'update'; $brand = $class_pb->retrieveDetail($brand_id); } if (isset($_POST['sp_brand_id']) && is_array($_POST['sp_brand_id'])) { foreach ($_POST['sp_brand_id'] as $jng_sp_id => $sp_brand_id) { $class_pb->updateSPbrandID($jng_sp_id, $brand_id, $sp_brand_id); } } header("Location: ?open=products-brand&id={$brand_id}&action={$action}"); exit; } elseif ($_POST['me_action'] == 'DELETEBRAND') { if ($id > 0) { if ($class_pb->delete($id) === false) { echo 'FAILED'; } else { echo 'OK'; } } exit; } elseif ($_POST['me_action'] == 'KILLBRAND') { $brand_id = $_POST['brand_id']; $class_pb->killBrand($brand_id, $session_userinfo['username'], true); exit; } } $is_deleted = false; if ($id != '') { $brand = $class_pb->retrieveDetail($id);