// end stuff that is done the first time the form is visited
if (isset($_POST['form_token']) && validateTokenField($_POST)) {
    error_log('will process the editing form');
    //   $activityType = "Edit";
    $profileActitivityStatus = "Unconfirmed";
    //retrieves the sw, and gets id, firstname and lastname
    $currentUser = getUserProfileID();
    $sw = retrieve_UserProfile_SW($currentUser);
    // what if the current user is a RMH staff?
    //print_r($sw);
    $swObject = current($sw);
    $sw_id = $swObject->get_userProfileId();
    $sw_fname = $swObject->get_swFirstName();
    $sw_lname = $swObject->get_swLastName();
    $dateSubmit = date("Y-m-d");
    $familyProfile = readFormData();
    error_log('read the form data, parent last name is ' . $familyProfile->get_parentlname());
    if ($showResult) {
        error_log("will call updateProfile");
        $ret = updateFamilyProfile($familyProfile);
        if ($ret == false) {
            echo "<section class=\"content\">";
            echo "Database error - could not update the family profile";
        } else {
            echo "<section class=\"content\">";
            echo "Update was successful";
        }
    } else {
        echo "<section class=\"content\">";
        error_log("the family profile was not updated");
        echo "The family profile has not been updated. Please correct errors and try again";
    $idChosen = $_GET['id'];
    error_log("in editReservation, request id is {$idChosen}");
    $informationroom = retrieve_RoomReservationActivity_byRequestId($idChosen);
    $beginDate = new DateTime($informationroom->get_beginDate());
    $endDate = new DateTime($informationroom->get_endDate());
    $formattedBeginDate = $beginDate->format('Y-m-d');
    $formattedEndDate = $endDate->format('Y-m-d');
    $showForm = true;
    unset($_SESSION['RequestID']);
    // so that we won't go through the retrieval steps after the first time
}
// end stuff that is done the first time the form is visited
//process the editing form
if (isset($_POST['form_token']) && validateTokenField($_POST)) {
    error_log("will process the edit form");
    $informationroom = readFormData();
    error_log('social worker id is ' . $informationroom->get_socialWorkerProfileId());
    error_log('rmh staff id is ' . $informationroom->get_rmhStaffProfileId());
    $beginDate = new DateTime($informationroom->get_beginDate());
    $endDate = new DateTime($informationroom->get_endDate());
    $formattedBeginDate = $beginDate->format('Y-m-d');
    $formattedEndDate = $endDate->format('Y-m-d');
    //if ($showResult)
    if (isset($_POST['Submit'])) {
        error_log("will call updateReservation");
        $ret = updateReservation($informationroom);
        if ($ret == -1) {
            echo "Could not update the Room Reservation";
        } else {
            echo "Update was successful";
        }