} //validate the date of start date field to make sure it is in mm/yyyy format. //because its optional, it is only validated if the field is not empty. if (!empty($wiseIntakeEmploymentStartDate) && !validateDate($wiseIntakeEmploymentStartDate, 'm/Y')) { $errorArray['wiseIntakeEmploymentStartDate'] = '<span class="form-error">Invalid date! Use mm/yyyy format!</span>'; } //check radio/checkbox data to make sure it is in the allowed array of options. (helps prevent spoofing) //only add the error if we know there is no current error for this input. wise_validate_radio_checkbox_spoofing($wiseIntakeDemoGender, 'wiseIntakeDemoGender', $demoGenderRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeDemoRace, 'wiseIntakeDemoRace', $demoRaceRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeDemoDisability, 'wiseIntakeDemoDisability', $yesNoRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeDemoPellGrant, 'wiseIntakeDemoPellGrant', $yesNoIDoNotKnowRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeDemoTAA, 'wiseIntakeDemoTAA', $yesNoIDoNotKnowRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeDemoEligibleVeteran, 'wiseIntakeDemoEligibleVeteran', $yesNoRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeDemoSpouseOfEligibleVeteran, 'wiseIntakeDemoSpouseOfEligibleVeteran', $yesNoRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeEmploymentStatus, 'wiseIntakeEmploymentStatus', $employmentStatusRadio); //if not empty, the work hours per week must be numeric. if (!empty($wiseIntakeEmploymentHoursPerWeek) && !is_numeric($wiseIntakeEmploymentHoursPerWeek)) { $errorArray['wiseIntakeEmploymentHoursPerWeek'] = '<span class="form-error">Hours per week must be a number!</span>'; } //the verify information checkbox does not need to be validated; we only need to know that it was set. //if required fields are not empty and data is valid, add the data for this form to the session array, //then redirect user to either the previous or next page. if (empty($errorArray)) { $_SESSION['wiseIntakeDemoGender'] = $wiseIntakeDemoGender; $_SESSION['wiseIntakeDemoDateOfBirth'] = $wiseIntakeDemoDateOfBirth; $_SESSION['wiseIntakeDemoPrimaryPhoneNumber'] = $wiseIntakeDemoPrimaryPhoneNumber; $_SESSION['wiseIntakeDemoPreferredEmail'] = $wiseIntakeDemoPreferredEmail; $_SESSION['wiseIntakeDemoRace'] = $wiseIntakeDemoRace; $_SESSION['wiseIntakeDemoDisability'] = $wiseIntakeDemoDisability; $_SESSION['wiseIntakeDemoPellGrant'] = $wiseIntakeDemoPellGrant;
$wiseIntakeCourse = wise_validate('wiseIntakeCourse', 'Course cannot be empty!'); $wiseIntakeMInitial = wise_clean_data($wiseIntakeMInitial); //optional, so it is just cleaned instead of validated. $wiseIntakeEduBackground = wise_validate('wiseIntakeEduBackground', 'You must select an Educational Background!'); $wiseIntakeEduGoal = wise_validate('wiseIntakeEduGoal', 'You must select a Goal!'); $wiseIntakeEduCurrentStatus = wise_validate('wiseIntakeEduCurrentStatus', 'You must select your Current Status!'); //intended programs was checked during variable assignment //check radio/checkbox data to make sure it is in the allowed array of options. (helps prevent spoofing) //only add the error if we know there is no current error for this input. wise_validate_radio_checkbox_spoofing($wiseIntakeEduBackground, 'wiseIntakeEduBackground', $eduBackgroundRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeEduGoal, 'wiseIntakeEduGoal', $eduGoalRadio); wise_validate_radio_checkbox_spoofing($wiseIntakeEduCurrentStatus, 'wiseIntakeEduCurrentStatus', $eduCurrentStatusRadio); //for the checkbox list, check each selected option to make sure it is on the list of actual options. //note that if the array is empty, no error will be added here. foreach ($wiseIntakeIntendedPrograms as $SelectedIntendedProgramOption) { wise_validate_radio_checkbox_spoofing($SelectedIntendedProgramOption, 'wiseIntakeIntendedPrograms', $intendedProgramsCheckboxes); } //if ""undecided/other" was checked, validate to make sure that the "other" value is not empty. if (isset($isOtherProgramGiven)) { wise_validate('wiseIntakeIntendedProgramOther', 'You must specify your "other" program!'); } //if required fields are not empty and data is valid, add the data for this form to the session array, //then redirect user to either the previous or next page (since this is page 1, redirect only to page 2). if (empty($errorArray)) { $_SESSION['wiseIntakeLName'] = $wiseIntakeLName; $_SESSION['wiseIntakeStudentID'] = $wiseIntakeStudentID; $_SESSION['wiseIntakeFName'] = $wiseIntakeFName; $_SESSION['wiseIntakeCourse'] = $wiseIntakeCourse; //optional, only add to session if not empty if (!empty($wiseIntakeMInitial)) { $_SESSION['wiseIntakeMInitial'] = $wiseIntakeMInitial;