97 lines
4.5 KiB
PHP
97 lines
4.5 KiB
PHP
|
|
<?php
|
|||
|
|
$success = false;
|
|||
|
|
$errors = [];
|
|||
|
|
|
|||
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
|
|
$name = trim(htmlspecialchars($_POST['name'] ?? '', ENT_QUOTES));
|
|||
|
|
$email = trim(htmlspecialchars($_POST['email'] ?? '', ENT_QUOTES));
|
|||
|
|
$phone = trim(htmlspecialchars($_POST['phone'] ?? '', ENT_QUOTES));
|
|||
|
|
$subject = trim(htmlspecialchars($_POST['subject'] ?? '', ENT_QUOTES));
|
|||
|
|
$message = trim(htmlspecialchars($_POST['message'] ?? '', ENT_QUOTES));
|
|||
|
|
|
|||
|
|
if (!$name) $errors[] = 'Name is required.';
|
|||
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) $errors[] = 'A valid email is required.';
|
|||
|
|
if (!$message) $errors[] = 'Message is required.';
|
|||
|
|
|
|||
|
|
if (empty($errors)) {
|
|||
|
|
// TODO: swap for DB insert + email once credentials are configured
|
|||
|
|
$success = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
|
|||
|
|
<section class="section page-hero">
|
|||
|
|
<div class="container">
|
|||
|
|
<span class="section__eyebrow">Reach Out</span>
|
|||
|
|
<h1 class="section__heading">Contact Us</h1>
|
|||
|
|
<p class="section__sub">Questions about service, coverage, or your account? We're here to help.</p>
|
|||
|
|
</div>
|
|||
|
|
</section>
|
|||
|
|
|
|||
|
|
<section class="section">
|
|||
|
|
<div class="container contact__grid">
|
|||
|
|
|
|||
|
|
<div class="contact__info">
|
|||
|
|
<h2 class="contact__heading">Get In Touch</h2>
|
|||
|
|
<ul class="contact__details">
|
|||
|
|
<li>📞 <a href="tel:+10000000000">(000) 000-0000</a></li>
|
|||
|
|
<li>✉ <a href="mailto:info@alwisp.net">info@alwisp.net</a></li>
|
|||
|
|
<li>🕐 Mon–Fri 8am–6pm CST<br>Emergency support 24/7</li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="contact__form-wrap">
|
|||
|
|
<?php if ($success): ?>
|
|||
|
|
<div class="alert alert--success" role="alert">
|
|||
|
|
Thanks! We'll be in touch within one business day.
|
|||
|
|
</div>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
|
|||
|
|
<?php if (!empty($errors)): ?>
|
|||
|
|
<div class="alert alert--error" role="alert">
|
|||
|
|
<ul><?php foreach ($errors as $e) echo "<li>" . $e . "</li>"; ?></ul>
|
|||
|
|
</div>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
|
|||
|
|
<form method="post" action="/contact" class="form" novalidate>
|
|||
|
|
<div class="form__row form__row--2">
|
|||
|
|
<div class="form__group">
|
|||
|
|
<label for="name" class="form__label">Name <span aria-hidden="true">*</span></label>
|
|||
|
|
<input type="text" id="name" name="name" class="form__input" required
|
|||
|
|
value="<?= htmlspecialchars($_POST['name'] ?? '') ?>">
|
|||
|
|
</div>
|
|||
|
|
<div class="form__group">
|
|||
|
|
<label for="email" class="form__label">Email <span aria-hidden="true">*</span></label>
|
|||
|
|
<input type="email" id="email" name="email" class="form__input" required
|
|||
|
|
value="<?= htmlspecialchars($_POST['email'] ?? '') ?>">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form__row form__row--2">
|
|||
|
|
<div class="form__group">
|
|||
|
|
<label for="phone" class="form__label">Phone</label>
|
|||
|
|
<input type="tel" id="phone" name="phone" class="form__input"
|
|||
|
|
value="<?= htmlspecialchars($_POST['phone'] ?? '') ?>">
|
|||
|
|
</div>
|
|||
|
|
<div class="form__group">
|
|||
|
|
<label for="subject" class="form__label">Subject</label>
|
|||
|
|
<select id="subject" name="subject" class="form__input">
|
|||
|
|
<option value="">Select a topic…</option>
|
|||
|
|
<option value="new-service">New Service Inquiry</option>
|
|||
|
|
<option value="support">Technical Support</option>
|
|||
|
|
<option value="billing">Billing Question</option>
|
|||
|
|
<option value="coverage">Coverage Question</option>
|
|||
|
|
<option value="other">Other</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form__group">
|
|||
|
|
<label for="message" class="form__label">Message <span aria-hidden="true">*</span></label>
|
|||
|
|
<textarea id="message" name="message" class="form__input form__textarea" rows="5" required><?= htmlspecialchars($_POST['message'] ?? '') ?></textarea>
|
|||
|
|
</div>
|
|||
|
|
<button type="submit" class="btn btn--primary">Send Message</button>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</section>
|