$wiseIntakeDemoGender = wise_session_item_check('wiseIntakeDemoGender');
$wiseIntakeDemoDateOfBirth = wise_session_item_check('wiseIntakeDemoDateOfBirth');
$wiseIntakeDemoPrimaryPhoneNumber = wise_session_item_check('wiseIntakeDemoPrimaryPhoneNumber');
$wiseIntakeDemoPreferredEmail = wise_session_item_check('wiseIntakeDemoPreferredEmail');
$wiseIntakeDemoRace = wise_session_item_check('wiseIntakeDemoRace');
$wiseIntakeDemoDisability = wise_session_item_check('wiseIntakeDemoDisability');
$wiseIntakeDemoPellGrant = wise_session_item_check('wiseIntakeDemoPellGrant');
$wiseIntakeDemoTAA = wise_session_item_check('wiseIntakeDemoTAA');
$wiseIntakeDemoEligibleVeteran = wise_session_item_check('wiseIntakeDemoEligibleVeteran');
$wiseIntakeDemoSpouseOfEligibleVeteran = wise_session_item_check('wiseIntakeDemoSpouseOfEligibleVeteran');
$wiseIntakeEmploymentStatus = wise_session_item_check('wiseIntakeEmploymentStatus');
$wiseIntakeEmployerName = wise_session_item_check('wiseIntakeEmployerName');
$wiseIntakeEmploymentStartDate = wise_session_item_check('wiseIntakeEmploymentStartDate');
$wiseIntakeEmploymentHoursPerWeek = wise_session_item_check('wiseIntakeEmploymentHoursPerWeek');
$wiseIntakeEmploymentCurrentSalary = wise_session_item_check('wiseIntakeEmploymentCurrentSalary');
$verifyQuestionnaire = wise_session_item_check('verifyQuestionnaire');
//form validation
require 'includes/wise-form-validation-2.php';
//radio values are placed in arrays to work with the create_radio_checkbox_list function
//to make the form sticky.
$wiseIntakeDemoGender = array('wiseIntakeDemoGender' => $wiseIntakeDemoGender);
$wiseIntakeDemoRace = array('wiseIntakeDemoRace' => $wiseIntakeDemoRace);
$wiseIntakeDemoDisability = array('wiseIntakeDemoDisability' => $wiseIntakeDemoDisability);
$wiseIntakeDemoPellGrant = array('wiseIntakeDemoPellGrant' => $wiseIntakeDemoPellGrant);
$wiseIntakeDemoTAA = array('wiseIntakeDemoTAA' => $wiseIntakeDemoTAA);
$wiseIntakeDemoEligibleVeteran = array('wiseIntakeDemoEligibleVeteran' => $wiseIntakeDemoEligibleVeteran);
$wiseIntakeDemoSpouseOfEligibleVeteran = array('wiseIntakeDemoSpouseOfEligibleVeteran' => $wiseIntakeDemoSpouseOfEligibleVeteran);
$wiseIntakeEmploymentStatus = array('wiseIntakeEmploymentStatus' => $wiseIntakeEmploymentStatus);
//this is page 2
$pageNumber = 2;
?>
 *Integrated Sector Employment (WISE) project. Users will fill
 *out the form, which is split into 4 pages. The data is stored
 *in a database and can be exported to an Excel csv file.
 */
//error reporting
ini_set('display_errors', 1);
error_reporting(E_ALL);
//start the session so that form data can be saved across pages
session_start();
//require functions list
require 'includes/functions.php';
//error array must be empty for information to be added to the session
$errorArray = array();
//get the session value to make the form sticky if the user is returning
//to this page before they submit the entire form
$verifyEqualOpportunityStatement = wise_session_item_check('verifyEqualOpportunityStatement');
//handle form if it was submitted
if (isset($_POST['submit'])) {
    //as a checkbox, this element's variable will be assigned and checked for emptiness without a function.
    if (!empty($_POST['verifyEqualOpportunityStatement'])) {
        $verifyEqualOpportunityStatement = $_POST['verifyEqualOpportunityStatement'];
    } else {
        $errorArray['verifyEqualOpportunityStatement'] = '<span class="form-error">You must verify the information to continue!</span>';
        $verifyEqualOpportunityStatement = array();
    }
    //add to the session if the box was checked, then redirect to previous or next page.
    if (empty($errorArray)) {
        $_SESSION['verifyEqualOpportunityStatement'] = $verifyEqualOpportunityStatement;
        //if previous button, go back to page 2. if anything else (including next button
        //or the user just hitting the enter key), go to page 4.
        if ($_POST['submit'] == 'previous') {
$wiseIntakeDemoSpouseOfEligibleVeteran = wise_session_item_check('wiseIntakeDemoSpouseOfEligibleVeteran');
//extra formatting
$wiseIntakeEmploymentStatus = wise_session_item_check('wiseIntakeEmploymentStatus');
$wiseIntakeEmployerName = wise_session_item_check('wiseIntakeEmployerName');
//optional
$wiseIntakeEmploymentStartDate = wise_session_item_check('wiseIntakeEmploymentStartDate');
//optional
$wiseIntakeEmploymentHoursPerWeek = wise_session_item_check('wiseIntakeEmploymentHoursPerWeek');
//optional
$wiseIntakeEmploymentCurrentSalary = wise_session_item_check('wiseIntakeEmploymentCurrentSalary');
//optional
$verifyQuestionnaire = wise_session_item_check('verifyQuestionnaire');
//extra formatting
$verifyEqualOpportunityStatement = wise_session_item_check('verifyEqualOpportunityStatement');
//extra formatting
$verifyFERPA = wise_session_item_check('verifyFERPA');
//extra formatting
//validate to make sure that all required fields are not empty. if the user went to this script directly via URL,
//then this script needs to display an error if the form wasnt filled out.
//validate data that does not require extra formatting:
if (empty($wiseIntakeLName) || empty($wiseIntakeStudentID) || empty($wiseIntakeFName) || empty($wiseIntakeCourse) || empty($wiseIntakeEduBackground) || empty($wiseIntakeEduGoal) || empty($wiseIntakeDemoPrimaryPhoneNumber) || empty($wiseIntakeDemoPreferredEmail) || empty($wiseIntakeDemoRace) || empty($wiseIntakeEmploymentStatus)) {
    //a catch-all error is used here, as the user should not be on this page if they
    //did not fill out the form, so specific error information should not be needed.
    $errorArray[] = 'An error occurred: Required user input form data missing';
}
//validating the intended programs and "other" value if it was selected.
//if not empty, no error is entered
if (!empty($wiseIntakeIntendedPrograms)) {
    //check each program to see if it is the "other" program option.
    foreach ($wiseIntakeIntendedPrograms as $checkForOtherProgram) {
        //if it is "other", only then do we validate the "other" value provided by the user.
//define the options for the radio/checkbox lists
require 'includes/wise-form-list-arrays.php';
/*if session variables are already set (probably because a user is looking at
 *this page via the previous button on the next page) then the form should be
 *filled out with the information that they entered. (form stickyness)
 */
$wiseIntakeLName = wise_session_item_check('wiseIntakeLName');
$wiseIntakeStudentID = wise_session_item_check('wiseIntakeStudentID');
$wiseIntakeFName = wise_session_item_check('wiseIntakeFName');
$wiseIntakeCourse = wise_session_item_check('wiseIntakeCourse');
$wiseIntakeMInitial = wise_session_item_check('wiseIntakeMInitial');
$wiseIntakeEduBackground = wise_session_item_check('wiseIntakeEduBackground');
$wiseIntakeEduGoal = wise_session_item_check('wiseIntakeEduGoal');
$wiseIntakeEduCurrentStatus = wise_session_item_check('wiseIntakeEduCurrentStatus');
$wiseIntakeIntendedPrograms = wise_session_item_check('wiseIntakeIntendedPrograms');
$wiseIntakeIntendedProgramOther = wise_session_item_check('wiseIntakeIntendedProgramOther');
//form validation
require 'includes/wise-form-validation-1.php';
//radio values are placed in arrays to work with the create_radio_checkbox_list function
//to make the form sticky.
$wiseIntakeEduBackground = array('wiseIntakeEduBackground' => $wiseIntakeEduBackground);
$wiseIntakeEduGoal = array('wiseIntakeEduGoal' => $wiseIntakeEduGoal);
$wiseIntakeEduCurrentStatus = array('wiseIntakeEduCurrentStatus' => $wiseIntakeEduCurrentStatus);
//this is page 1
$pageNumber = 1;
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<!--	Author: Alex Ball
					Date: 11/30/2015