application
This commit is contained in:
+585
@@ -0,0 +1,585 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/data.php';
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim and remove control characters from submitted text.
|
||||
*/
|
||||
function application_clean($value): string
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$value = trim($value);
|
||||
return preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/u', '', $value) ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep spreadsheet software from treating a cell as a formula.
|
||||
*/
|
||||
function application_csv_value(string $value): string
|
||||
{
|
||||
if ($value !== '' && strpos('=+-@', $value[0]) !== false) {
|
||||
return "'" . $value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
$pageTitle = 'Apply Now | AI Institute';
|
||||
$pageDescription = 'Submit your candidate dossier to apply for an AI Institute programme.';
|
||||
$activePage = 'apply';
|
||||
|
||||
$genderOptions = ['Male', 'Female', 'Non-binary', 'Prefer not to say'];
|
||||
$educationOptions = ['High School', 'Diploma', "Bachelor's", "Master's", 'PhD', 'Other'];
|
||||
$sourceOptions = ['Search engine', 'Social media', 'Friend/Colleague', 'Advertisement', 'Event', 'Other'];
|
||||
|
||||
$courseOptions = [];
|
||||
foreach ($courses as $courseOption) {
|
||||
$courseOptions[] = [
|
||||
'slug' => $courseOption['slug'] ?? '',
|
||||
'title' => $courseOption['title'] ?? '',
|
||||
];
|
||||
}
|
||||
$courseSlugs = array_column($courseOptions, 'slug');
|
||||
|
||||
if (empty($_SESSION['application_csrf'])) {
|
||||
$_SESSION['application_csrf'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
$csrfToken = $_SESSION['application_csrf'];
|
||||
|
||||
$requestedCourse = application_clean($_GET['course'] ?? '');
|
||||
|
||||
$old = [
|
||||
'full_name' => '',
|
||||
'phone' => '',
|
||||
'email' => '',
|
||||
'age' => '',
|
||||
'gender' => '',
|
||||
'location' => '',
|
||||
'education' => '',
|
||||
'institution' => '',
|
||||
'occupation' => '',
|
||||
'course' => in_array($requestedCourse, $courseSlugs, true) ? $requestedCourse : '',
|
||||
'ai_experience' => '',
|
||||
'professional_experience' => '',
|
||||
'skills' => '',
|
||||
'career_goal' => '',
|
||||
'source' => '',
|
||||
'message' => '',
|
||||
'terms' => '',
|
||||
];
|
||||
|
||||
$errors = [];
|
||||
$success = false;
|
||||
|
||||
if (($_SERVER['REQUEST_METHOD'] ?? '') === 'POST') {
|
||||
$old = [
|
||||
'full_name' => application_clean($_POST['full_name'] ?? ''),
|
||||
'phone' => application_clean($_POST['phone'] ?? ''),
|
||||
'email' => application_clean($_POST['email'] ?? ''),
|
||||
'age' => application_clean($_POST['age'] ?? ''),
|
||||
'gender' => application_clean($_POST['gender'] ?? ''),
|
||||
'location' => application_clean($_POST['location'] ?? ''),
|
||||
'education' => application_clean($_POST['education'] ?? ''),
|
||||
'institution' => application_clean($_POST['institution'] ?? ''),
|
||||
'occupation' => application_clean($_POST['occupation'] ?? ''),
|
||||
'course' => application_clean($_POST['course'] ?? ''),
|
||||
'ai_experience' => application_clean($_POST['ai_experience'] ?? ''),
|
||||
'professional_experience' => application_clean($_POST['professional_experience'] ?? ''),
|
||||
'skills' => application_clean($_POST['skills'] ?? ''),
|
||||
'career_goal' => application_clean($_POST['career_goal'] ?? ''),
|
||||
'source' => application_clean($_POST['source'] ?? ''),
|
||||
'message' => application_clean($_POST['message'] ?? ''),
|
||||
'terms' => isset($_POST['terms']) ? '1' : '',
|
||||
];
|
||||
|
||||
$honeypot = application_clean($_POST['website'] ?? '');
|
||||
$postedToken = is_string($_POST['csrf_token'] ?? null) ? $_POST['csrf_token'] : '';
|
||||
|
||||
if ($honeypot !== '') {
|
||||
$success = true;
|
||||
} elseif (!hash_equals($csrfToken, $postedToken)) {
|
||||
$errors['form'] = 'Your session expired. Please review your details and submit the form again.';
|
||||
} else {
|
||||
if ($old['full_name'] === '') {
|
||||
$errors['full_name'] = 'Please enter your full name.';
|
||||
} elseif (strlen($old['full_name']) > 120) {
|
||||
$errors['full_name'] = 'Please keep your full name under 120 characters.';
|
||||
}
|
||||
|
||||
$phoneDigits = preg_replace('/\D+/', '', $old['phone']);
|
||||
if ($old['phone'] === '') {
|
||||
$errors['phone'] = 'Please enter your phone number.';
|
||||
} elseif (!preg_match('/^[0-9+\-()\s]+$/', $old['phone']) || strlen($phoneDigits) < 7) {
|
||||
$errors['phone'] = 'Please enter a valid phone number with at least 7 digits.';
|
||||
} elseif (strlen($phoneDigits) > 20) {
|
||||
$errors['phone'] = 'Please enter a phone number with no more than 20 digits.';
|
||||
}
|
||||
|
||||
if ($old['email'] === '') {
|
||||
$errors['email'] = 'Please enter your email address.';
|
||||
} elseif (!filter_var($old['email'], FILTER_VALIDATE_EMAIL) || strlen($old['email']) > 254) {
|
||||
$errors['email'] = 'Please enter a valid email address.';
|
||||
}
|
||||
|
||||
if ($old['age'] !== '') {
|
||||
if (!ctype_digit($old['age']) || (int) $old['age'] < 16 || (int) $old['age'] > 100) {
|
||||
$errors['age'] = 'Age must be a number between 16 and 100.';
|
||||
}
|
||||
}
|
||||
|
||||
if ($old['gender'] !== '' && !in_array($old['gender'], $genderOptions, true)) {
|
||||
$errors['gender'] = 'Please choose a valid gender option.';
|
||||
}
|
||||
|
||||
if (strlen($old['location']) > 150) {
|
||||
$errors['location'] = 'Please keep your location under 150 characters.';
|
||||
}
|
||||
|
||||
if ($old['education'] !== '' && !in_array($old['education'], $educationOptions, true)) {
|
||||
$errors['education'] = 'Please choose a valid education level.';
|
||||
}
|
||||
|
||||
if (strlen($old['institution']) > 160) {
|
||||
$errors['institution'] = 'Please keep the institution name under 160 characters.';
|
||||
}
|
||||
|
||||
if (strlen($old['occupation']) > 160) {
|
||||
$errors['occupation'] = 'Please keep your occupation under 160 characters.';
|
||||
}
|
||||
|
||||
if ($old['course'] !== '' && !in_array($old['course'], $courseSlugs, true)) {
|
||||
$errors['course'] = 'Please choose a valid course track.';
|
||||
}
|
||||
|
||||
foreach (['ai_experience', 'professional_experience', 'skills', 'career_goal', 'message'] as $longField) {
|
||||
if (strlen($old[$longField]) > 5000) {
|
||||
$errors[$longField] = 'Please keep this response under 5,000 characters.';
|
||||
}
|
||||
}
|
||||
|
||||
if ($old['source'] !== '' && !in_array($old['source'], $sourceOptions, true)) {
|
||||
$errors['source'] = 'Please choose a valid option.';
|
||||
}
|
||||
|
||||
if ($old['terms'] !== '1') {
|
||||
$errors['terms'] = 'Please agree to the Terms to continue.';
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
$storageDir = __DIR__ . '/storage';
|
||||
$storageFile = $storageDir . '/applications.csv';
|
||||
$saved = false;
|
||||
|
||||
if (!is_dir($storageDir)) {
|
||||
@mkdir($storageDir, 0775, true);
|
||||
}
|
||||
|
||||
$handle = @fopen($storageFile, 'a');
|
||||
|
||||
if ($handle !== false) {
|
||||
if (flock($handle, LOCK_EX)) {
|
||||
$isNewFile = ftell($handle) === 0;
|
||||
|
||||
if ($isNewFile) {
|
||||
fputcsv($handle, [
|
||||
'submitted_at',
|
||||
'full_name',
|
||||
'phone',
|
||||
'email',
|
||||
'age',
|
||||
'gender',
|
||||
'location',
|
||||
'education',
|
||||
'institution',
|
||||
'occupation',
|
||||
'course',
|
||||
'ai_experience',
|
||||
'professional_experience',
|
||||
'skills',
|
||||
'career_goal',
|
||||
'source',
|
||||
'message',
|
||||
]);
|
||||
}
|
||||
|
||||
$row = [
|
||||
date('c'),
|
||||
$old['full_name'],
|
||||
$old['phone'],
|
||||
$old['email'],
|
||||
$old['age'],
|
||||
$old['gender'],
|
||||
$old['location'],
|
||||
$old['education'],
|
||||
$old['institution'],
|
||||
$old['occupation'],
|
||||
$old['course'],
|
||||
$old['ai_experience'],
|
||||
$old['professional_experience'],
|
||||
$old['skills'],
|
||||
$old['career_goal'],
|
||||
$old['source'],
|
||||
$old['message'],
|
||||
];
|
||||
|
||||
fputcsv($handle, array_map('application_csv_value', $row));
|
||||
fflush($handle);
|
||||
flock($handle, LOCK_UN);
|
||||
$saved = true;
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
if ($saved) {
|
||||
$success = true;
|
||||
$old = array_fill_keys(array_keys($old), '');
|
||||
unset($_SESSION['application_csrf']);
|
||||
$_SESSION['application_csrf'] = bin2hex(random_bytes(32));
|
||||
$csrfToken = $_SESSION['application_csrf'];
|
||||
} else {
|
||||
$errors['form'] = 'We could not save your application right now. Please try again in a moment.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
<main id="main-content" class="application-page">
|
||||
<div class="container">
|
||||
<header class="application-header">
|
||||
<h1 class="application-title">Apply Now</h1>
|
||||
<p class="application-subtitle">Please complete all required fields below to submit your candidate dossier.</p>
|
||||
</header>
|
||||
|
||||
<section class="application-card" aria-labelledby="application-card-title">
|
||||
<?php if ($success): ?>
|
||||
<div class="application-success" role="status" aria-live="polite">
|
||||
<span class="application-success__icon"><?= icon('check-circle') ?></span>
|
||||
<h2 class="application-success__title" id="application-card-title">Thank you, your application has been submitted</h2>
|
||||
<p class="application-success__text">Our admissions team will review your details and contact you using the information you provided.</p>
|
||||
<a class="btn btn--primary" href="index.php">Back to Home <?= icon('arrow-right') ?></a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<h2 class="application-card__title" id="application-card-title">Applicant Details</h2>
|
||||
|
||||
<?php if (!empty($errors['form'])): ?>
|
||||
<div class="application-alert application-alert--error" role="alert">
|
||||
<?= e($errors['form']) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form class="application-form" method="post" novalidate>
|
||||
<input type="hidden" name="csrf_token" value="<?= e($csrfToken) ?>">
|
||||
<div class="application-hp" aria-hidden="true">
|
||||
<label for="website">Website</label>
|
||||
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['full_name']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="full-name">Full Name <span class="application-required" aria-hidden="true">*</span></label>
|
||||
<input
|
||||
class="application-input application-input--standalone"
|
||||
id="full-name"
|
||||
name="full_name"
|
||||
type="text"
|
||||
value="<?= e($old['full_name']) ?>"
|
||||
placeholder="Full name"
|
||||
autocomplete="name"
|
||||
required
|
||||
aria-required="true"
|
||||
aria-invalid="<?= isset($errors['full_name']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="full-name-error"
|
||||
>
|
||||
<span class="application-error" id="full-name-error" data-error-for="full_name" aria-live="polite"><?= e($errors['full_name'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-row">
|
||||
<div class="application-field<?= isset($errors['phone']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="phone">Phone Number <span class="application-required" aria-hidden="true">*</span></label>
|
||||
<div class="application-control">
|
||||
<span class="application-icon"><?= icon('phone') ?></span>
|
||||
<input
|
||||
class="application-input"
|
||||
id="phone"
|
||||
name="phone"
|
||||
type="tel"
|
||||
value="<?= e($old['phone']) ?>"
|
||||
placeholder="+1 (555) 000-0000"
|
||||
autocomplete="tel"
|
||||
inputmode="tel"
|
||||
required
|
||||
aria-required="true"
|
||||
aria-invalid="<?= isset($errors['phone']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="phone-error"
|
||||
>
|
||||
</div>
|
||||
<span class="application-error" id="phone-error" data-error-for="phone" aria-live="polite"><?= e($errors['phone'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['email']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="email">Email <span class="application-required" aria-hidden="true">*</span></label>
|
||||
<div class="application-control">
|
||||
<span class="application-icon"><?= icon('mail') ?></span>
|
||||
<input
|
||||
class="application-input"
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
value="<?= e($old['email']) ?>"
|
||||
placeholder="name@example.com"
|
||||
autocomplete="email"
|
||||
required
|
||||
aria-required="true"
|
||||
aria-invalid="<?= isset($errors['email']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="email-error"
|
||||
>
|
||||
</div>
|
||||
<span class="application-error" id="email-error" data-error-for="email" aria-live="polite"><?= e($errors['email'] ?? '') ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="application-row">
|
||||
<div class="application-field<?= isset($errors['age']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="age">Age</label>
|
||||
<input
|
||||
class="application-input application-input--standalone"
|
||||
id="age"
|
||||
name="age"
|
||||
type="number"
|
||||
min="16"
|
||||
max="100"
|
||||
value="<?= e($old['age']) ?>"
|
||||
placeholder="e.g. 28"
|
||||
inputmode="numeric"
|
||||
aria-invalid="<?= isset($errors['age']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="age-error"
|
||||
>
|
||||
<span class="application-error" id="age-error" data-error-for="age" aria-live="polite"><?= e($errors['age'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['gender']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="gender">Gender – optional</label>
|
||||
<select
|
||||
class="application-select"
|
||||
id="gender"
|
||||
name="gender"
|
||||
aria-invalid="<?= isset($errors['gender']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="gender-error"
|
||||
>
|
||||
<option value="">Select gender (optional)</option>
|
||||
<?php foreach ($genderOptions as $gender): ?>
|
||||
<option value="<?= e($gender) ?>"<?= $old['gender'] === $gender ? ' selected' : '' ?>><?= e($gender) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<span class="application-error" id="gender-error" data-error-for="gender" aria-live="polite"><?= e($errors['gender'] ?? '') ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['location']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="location">Location</label>
|
||||
<div class="application-control">
|
||||
<span class="application-icon"><?= icon('map-pin') ?></span>
|
||||
<input
|
||||
class="application-input"
|
||||
id="location"
|
||||
name="location"
|
||||
type="text"
|
||||
value="<?= e($old['location']) ?>"
|
||||
placeholder="City, Country"
|
||||
autocomplete="address-level2"
|
||||
aria-invalid="<?= isset($errors['location']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="location-error"
|
||||
>
|
||||
</div>
|
||||
<span class="application-error" id="location-error" data-error-for="location" aria-live="polite"><?= e($errors['location'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-row">
|
||||
<div class="application-field<?= isset($errors['education']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="education">Highest education</label>
|
||||
<select
|
||||
class="application-select"
|
||||
id="education"
|
||||
name="education"
|
||||
aria-invalid="<?= isset($errors['education']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="education-error"
|
||||
>
|
||||
<option value="">Select highest education</option>
|
||||
<?php foreach ($educationOptions as $education): ?>
|
||||
<option value="<?= e($education) ?>"<?= $old['education'] === $education ? ' selected' : '' ?>><?= e($education) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<span class="application-error" id="education-error" data-error-for="education" aria-live="polite"><?= e($errors['education'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['institution']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="institution">Institution</label>
|
||||
<input
|
||||
class="application-input application-input--standalone"
|
||||
id="institution"
|
||||
name="institution"
|
||||
type="text"
|
||||
value="<?= e($old['institution']) ?>"
|
||||
placeholder="University or institution name"
|
||||
autocomplete="organization"
|
||||
aria-invalid="<?= isset($errors['institution']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="institution-error"
|
||||
>
|
||||
<span class="application-error" id="institution-error" data-error-for="institution" aria-live="polite"><?= e($errors['institution'] ?? '') ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['occupation']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="occupation">Current occupation</label>
|
||||
<input
|
||||
class="application-input application-input--standalone"
|
||||
id="occupation"
|
||||
name="occupation"
|
||||
type="text"
|
||||
value="<?= e($old['occupation']) ?>"
|
||||
placeholder="e.g. Software Engineer, Researcher, Student"
|
||||
autocomplete="organization-title"
|
||||
aria-invalid="<?= isset($errors['occupation']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="occupation-error"
|
||||
>
|
||||
<span class="application-error" id="occupation-error" data-error-for="occupation" aria-live="polite"><?= e($errors['occupation'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['course']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="course">Course interested in</label>
|
||||
<select
|
||||
class="application-select"
|
||||
id="course"
|
||||
name="course"
|
||||
aria-invalid="<?= isset($errors['course']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="course-error"
|
||||
>
|
||||
<option value="">Select course track</option>
|
||||
<?php foreach ($courseOptions as $courseOption): ?>
|
||||
<option value="<?= e($courseOption['slug']) ?>"<?= $old['course'] === $courseOption['slug'] ? ' selected' : '' ?>><?= e($courseOption['title']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<span class="application-error" id="course-error" data-error-for="course" aria-live="polite"><?= e($errors['course'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['ai_experience']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="ai-experience">Previous AI experience</label>
|
||||
<textarea
|
||||
class="application-textarea"
|
||||
id="ai-experience"
|
||||
name="ai_experience"
|
||||
placeholder="Describe any previous experience with machine learning, neural networks, or AI research..."
|
||||
aria-invalid="<?= isset($errors['ai_experience']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="ai-experience-error"
|
||||
><?= e($old['ai_experience']) ?></textarea>
|
||||
<span class="application-error" id="ai-experience-error" data-error-for="ai_experience" aria-live="polite"><?= e($errors['ai_experience'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['professional_experience']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="professional-experience">Professional experience</label>
|
||||
<textarea
|
||||
class="application-textarea"
|
||||
id="professional-experience"
|
||||
name="professional_experience"
|
||||
placeholder="Overview of professional roles, projects, or work history..."
|
||||
aria-invalid="<?= isset($errors['professional_experience']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="professional-experience-error"
|
||||
><?= e($old['professional_experience']) ?></textarea>
|
||||
<span class="application-error" id="professional-experience-error" data-error-for="professional_experience" aria-live="polite"><?= e($errors['professional_experience'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['skills']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="skills">Current skills</label>
|
||||
<textarea
|
||||
class="application-textarea"
|
||||
id="skills"
|
||||
name="skills"
|
||||
placeholder="List programming languages, frameworks, toolkits (e.g. Python, PyTorch, CUDA, C++)..."
|
||||
aria-invalid="<?= isset($errors['skills']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="skills-error"
|
||||
><?= e($old['skills']) ?></textarea>
|
||||
<span class="application-error" id="skills-error" data-error-for="skills" aria-live="polite"><?= e($errors['skills'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['career_goal']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="career-goal">Career goal</label>
|
||||
<textarea
|
||||
class="application-textarea"
|
||||
id="career-goal"
|
||||
name="career_goal"
|
||||
placeholder="What are your career objectives and what do you aim to achieve after this course?"
|
||||
aria-invalid="<?= isset($errors['career_goal']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="career-goal-error"
|
||||
><?= e($old['career_goal']) ?></textarea>
|
||||
<span class="application-error" id="career-goal-error" data-error-for="career_goal" aria-live="polite"><?= e($errors['career_goal'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['source']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="source">How did you hear about us?</label>
|
||||
<select
|
||||
class="application-select"
|
||||
id="source"
|
||||
name="source"
|
||||
aria-invalid="<?= isset($errors['source']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="source-error"
|
||||
>
|
||||
<option value="">Select discovery channel</option>
|
||||
<?php foreach ($sourceOptions as $source): ?>
|
||||
<option value="<?= e($source) ?>"<?= $old['source'] === $source ? ' selected' : '' ?>><?= e($source) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<span class="application-error" id="source-error" data-error-for="source" aria-live="polite"><?= e($errors['source'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field<?= isset($errors['message']) ? ' has-error' : '' ?>">
|
||||
<label class="application-label" for="message">Message / questions</label>
|
||||
<textarea
|
||||
class="application-textarea"
|
||||
id="message"
|
||||
name="message"
|
||||
placeholder="Any additional questions, inquiries, or notes for the admissions team..."
|
||||
aria-invalid="<?= isset($errors['message']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="message-error"
|
||||
><?= e($old['message']) ?></textarea>
|
||||
<span class="application-error" id="message-error" data-error-for="message" aria-live="polite"><?= e($errors['message'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-field application-field--check<?= isset($errors['terms']) ? ' has-error' : '' ?>">
|
||||
<label class="application-check" for="terms">
|
||||
<input
|
||||
class="application-check__input"
|
||||
id="terms"
|
||||
name="terms"
|
||||
type="checkbox"
|
||||
value="1"
|
||||
<?= $old['terms'] === '1' ? 'checked' : '' ?>
|
||||
required
|
||||
aria-required="true"
|
||||
aria-invalid="<?= isset($errors['terms']) ? 'true' : 'false' ?>"
|
||||
aria-describedby="terms-error"
|
||||
>
|
||||
<span class="application-check__label">I agree to the Terms and consent to application processing. <span class="application-required" aria-hidden="true">*</span></span>
|
||||
</label>
|
||||
<span class="application-error" id="terms-error" data-error-for="terms" aria-live="polite"><?= e($errors['terms'] ?? '') ?></span>
|
||||
</div>
|
||||
|
||||
<div class="application-actions">
|
||||
<button class="btn btn--primary application-submit" type="submit">
|
||||
<span class="application-submit__label">Submit Application</span>
|
||||
<?= icon('arrow-right') ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
<?php require __DIR__ . '/includes/footer.php'; ?>
|
||||
Reference in New Issue
Block a user