function process_form()
{
    if ($_POST['_form_submit'] == 1) {
        error_log("exporting data step 1");
        $select_all_regexp = ".";
        if (!isset($_POST['first_name']) || $_POST['first_name'] == "") {
            $_SESSION['first_name'] = $select_all_regexp;
        } else {
            $_SESSION['first_name'] = $_POST['first_name'];
        }
        if (!isset($_POST['last_name']) || $_POST['last_name'] == "") {
            $_SESSION['last_name'] = $select_all_regexp;
        } else {
            $_SESSION['last_name'] = $_POST['last_name'];
        }
        if (!isset($_POST['gender']) || $_POST['gender'] == "") {
            $_SESSION['gender'] = $select_all_regexp;
        } else {
            $_SESSION['gender'] = $_POST['gender'];
        }
        if (!isset($_POST['type'])) {
            $_SESSION['type'] = [];
        } else {
            $_SESSION['type'] = $_POST['type'];
        }
        if (!isset($_POST['status']) || $_POST['status'] == "") {
            $_SESSION['status'] = $select_all_regexp;
        } else {
            $_SESSION['status'] = $_POST['status'];
        }
        if (!isset($_POST['start_date']) || $_POST['start_date'] == "") {
            $_SESSION['start_date'] = $select_all_regexp;
        } else {
            $_SESSION['start_date'] = $_POST['start_date'];
        }
        if (!isset($_POST['city']) || $_POST['city'] == "") {
            $_SESSION['city'] = $select_all_regexp;
        } else {
            $_SESSION['city'] = $_POST['city'];
        }
        if (!isset($_POST['zip']) || $_POST['zip'] == "") {
            $_SESSION['zip'] = $select_all_regexp;
        } else {
            $_SESSION['zip'] = $_POST['zip'];
        }
        if (!isset($_POST['phone']) || $_POST['phone'] == "") {
            $_SESSION['phone'] = $select_all_regexp;
        } else {
            $_SESSION['phone'] = $_POST['phone'];
        }
        if (!isset($_POST['email']) || $_POST['email'] == "") {
            $_SESSION['email'] = $select_all_regexp;
        } else {
            $_SESSION['email'] = $_POST['email'];
        }
        error_log("first name = " . $_SESSION['first_name']);
        error_log("last name = " . $_SESSION['last_name']);
        error_log("gender = " . $_SESSION['gender']);
        foreach ($_SESSION['type'] as $t) {
            error_log("type selected " . $t);
        }
        error_log("status = " . $_SESSION['status']);
        error_log("start date = " . $_SESSION['start_date']);
        error_log("city = " . $_SESSION['city']);
        error_log("zip = " . $_SESSION['zip']);
        error_log("phone = " . $_SESSION['phone']);
        error_log("email = " . $_SESSION['email']);
        $result = get_people_for_export("*", $_SESSION['first_name'], $_SESSION['last_name'], $_SESSION['gender'], $_SESSION['type'], $_SESSION['status'], $_SESSION['start_date'], $_SESSION['city'], $_SESSION['zip'], $_SESSION['phone'], $_SESSION['email']);
        $returned_people = [];
        while ($result_row = mysql_fetch_assoc($result)) {
            $person = make_a_person($result_row);
            $returned_people[] = $person;
        }
        $_SESSION['returned_people'] = serialize($returned_people);
        error_log("returns " . count($_SESSION['returned_people']) . "people");
        include 'dataResults.inc.php';
    } else {
        if ($_POST['_form_submit'] == 2) {
            error_log("Exporting data step 2");
            $_SESSION['results'] = $_POST['results_list'];
            if ($_POST['all_export']) {
                $export_people = [];
                error_log("returns " . count(unserialize($_SESSION['returned_people'])) . "people");
                foreach (unserialize($_SESSION['returned_people']) as $p) {
                    $export_people[] = $p->get_id();
                    error_log("Exporting data for " . $p->get_id());
                }
                error_log("Exporting all data.");
                $_SESSION['selected_people'] = $export_people;
                include 'dataExport.inc.php';
            } else {
                if ($_POST['b_export']) {
                    error_log("Exporting selected data");
                    if ($_POST['results_list']) {
                        $_SESSION['selected_people'] = $_POST['results_list'];
                        foreach ($_POST['results_list'] as $export_person) {
                            $temp_dude = retrieve_person($export_person);
                            error_log("Exporting data for " . $temp_dude->get_first_name() . " " . $temp_dude->get_last_name());
                        }
                    }
                    include 'dataExport.inc.php';
                }
            }
        } else {
            if ($_POST['_form_submit'] == 3) {
                error_log("Exporting data step 3");
                $_POST['export_attr'][] = 'id';
                $all_attrs_concat = implode(", ", $_POST['export_attr']);
                echo $all_attrs_concat;
                error_log("All attributes = " . $all_attrs_concat);
                foreach ($_POST['export_attr'] as $attr) {
                    error_log("attr to be exported " . $attr);
                }
                $result = get_people_for_export($all_attrs_concat, $_SESSION['first_name'], $_SESSION['last_name'], $_SESSION['gender'], $_SESSION['type'], $_SESSION['status'], $_SESSION['start_date'], $_SESSION['city'], $_SESSION['zip'], $_SESSION['phone'], $_SESSION['email']);
                $export_data = [];
                while ($result_row = mysql_fetch_assoc($result)) {
                    if (in_array($result_row['id'], $_SESSION['selected_people'])) {
                        $temp_person = [$result_row['id']];
                        foreach ($result_row as $row) {
                            if (!isset($row) || $row == "") {
                                $row = "";
                            }
                            $temp_person[] = $row;
                        }
                        $export_data[] = array_slice($temp_person, 0, count($temp_person) - 1);
                    }
                }
                date_default_timezone_set('America/New_York');
                $current_time = ["Export date: " . date("F j, Y, g:i a")];
                export_data($current_time, array_merge(["id"], $_POST['export_attr']), $export_data);
            }
        }
    }
}
     $group = $_POST['xgroup'];
 } else {
     $group = '';
 }
 if ($_POST['check6'] == 'on') {
     $role = $_POST['xrole'];
 } else {
     $role = '';
 }
 if ($_POST['check7'] == 'on') {
     $month = $_POST['month'];
 } else {
     $month = '';
 }
 $attribute_array = array(array(1 => $_POST['check1'], 'First Name', $first_name), array(1 => $_POST['check2'], 'Last Name', $last_name), array(1 => $_POST['check3'], 'Type', $type), array(1 => $_POST['check4'], 'Status', $status), array(1 => $_POST['check5'], 'Group', $group), array(1 => $_POST['check6'], 'Role', $role), array(1 => $_POST['check7'], 'Month', $month));
 $returned_people = get_people_for_export($first_name, $last_name, $type, $status, $group, $role);
 $returned_shifts = get_crews_for_export($returned_people, $month, $group);
 $current_time = array("Export date: " . date("m/d/Y g:ia"));
 for ($i = 0; $i <= count($attribute_array); $i++) {
     if ($attribute_array[$i][1] == 'on') {
         $search_attr .= $attribute_array[$i][2] . "=" . $attribute_array[$i][3] . ", ";
     }
 }
 $search_attr = substr($search_attr, 0, -2);
 $data_to_export = array();
 foreach ($returned_people as $p) {
     $data_row = array($p->get_id(), $p->get_first_name(), $p->get_last_name(), $p->get_address(), $p->get_city(), $p->get_state(), $p->get_zip(), $p->get_phone1(), $p->get_phone2(), $p->get_email(), $p->get_type(), $p->get_address(), implode(',', $p->get_group()), implode(',', $p->get_role()), $p->get_status(), $p->get_birthday(), $p->get_start_date(), $p->get_notes());
     $data_to_export[] = $data_row;
 }
 foreach ($returned_shifts as $returned_shift) {
     $data_to_export[] = $returned_shift;