// change action when not everything is filled-in if ($_POST['roles_name'] == '') { $_POST['action'] = 'enter_data'; $error_level = 1; // No roles_name } else { if ($_POST['categories_id'] == '') { $_POST['action'] = 'enter_data'; $error_level = 2; // No categories_id } else { /******************************/ /*** OK, entry can be saved ***/ /******************************/ $administration_role = new role($_POST['roles_id']); $administration_role->fill($_POST['roles_name'], $_POST['roles_description'], $_POST['roles_mandatory_ticket_entry'], $_POST['projects_id'], $_POST['categories_id']); $administration_role->save(); // Clear all values except mPath and projects_id foreach ($_POST as $key => $value) { if ($key != 'mPath' && $key != 'projects_id') { unset($_POST[$key]); } } } } break; case 'delete_entry': // Check for dependencies $administration_role = new role($_POST['roles_id']); if ($administration_role->has_dependencies()) { $error_level = 3;