Files
alwisp/www/pages/contact.php
Claude 5c8c406082 Update contact subject dropdown to match actual services; update README
Contact form subject options now match the five service lines on the site:
New Project Inquiry, Mesh Networking, Managed Services, Structured
Cabling, Access Control, IP Camera Systems, Technical Support, Other.
Removed the old ISP-generic options (billing, coverage, new-service).
Updated $subject_labels in admin-inbox.php to match.

README updates:
- ADMIN_PASS added to web container env vars table and env vars section
- Project structure updated to include db.php and admin-inbox.php
- Milestone 1 contact form item updated to note MySQL storage
- Milestone 4 marks contact DB storage and staff inbox as complete;
  email notification remains as the next open item

https://claude.ai/code/session_015wpwmheufcxkBuXivrSHhd
2026-03-01 03:14:02 +00:00

112 lines
5.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once __DIR__ . '/../includes/db.php';
$success = false;
$errors = [];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Store raw values; htmlspecialchars is applied only at output time
$name = trim($_POST['name'] ?? '');
$email = trim($_POST['email'] ?? '');
$phone = trim($_POST['phone'] ?? '');
$subject = trim($_POST['subject'] ?? '');
$message = trim($_POST['message'] ?? '');
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)) {
try {
$db = get_db();
$stmt = $db->prepare(
"INSERT INTO contacts (name, email, phone, subject, message)
VALUES (?, ?, ?, ?, ?)"
);
$stmt->execute([$name, $email, $phone, $subject, $message]);
$success = true;
} catch (PDOException $e) {
$errors[] = 'Sorry, we could not save your message right now. Please try again.';
}
}
}
?>
<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>🕐 MonFri 8am6pm 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-project">New Project Inquiry</option>
<option value="mesh-networking">Mesh Networking</option>
<option value="managed-services">Managed Services</option>
<option value="structured-cabling">Structured Cabling</option>
<option value="access-control">Access Control</option>
<option value="ip-cameras">IP Camera Systems</option>
<option value="support">Technical Support</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>