exit; } else { $_SESSION['error'] = "You must complete the form to discontinue a patient from the trial. Please try again."; header("Location:index.php"); exit; } } else { if ($page === 'adverseevent') { unset($_SESSION['inputErr']); $ae = new AdverseEvent(); $complete = $trial->addUserInput($_POST, $ae); $ae->makeActive(); if ($complete) { $ae->saveToDB(); $trial->addAdverseEvent($ae); $email = $trial->generateAdverseEventEmail(); $trial->sendEmail($email); $_SESSION['message'] = "Thank you for recording this adverse event."; } else { $_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.';