$_SESSION['error'] = "You must complete the adverse event form in its entirety, please try again."; } header("Location:index.php"); exit; } else { if ($page === 'violation') { unset($_SESSION['inputErr']); $v = new Violation(); $complete = $trial->addUserInput($_POST, $v); if ($complete) { if (!$v->hasViolation()) { $_SESSION['error'] = 'No deviation was selected. Please try again.'; } else { $v->saveToDB(); $trial->addViolation($v); $email = $trial->generateViolationEmail(); $trial->sendEmail($email); $_SESSION['message'] = "Thank you for recording this protocol deviation."; } } else { $_SESSION['error'] = "You must complete the protocol deviation form in its entirety, please try again."; } header("Location:index.php"); exit; } else { $complete = $trial->addUserInput($_POST); if ($page == 'core' && $trial->record->checkDuplicate()) { $_SESSION['error'] = "{$trial->record->getID()} - A patient has already been entered from that centre with that " . Config::get('idName') . "."; $complete = false; } else { $trial->record->saveToDB();