182 lines
6.9 KiB
PHP
182 lines
6.9 KiB
PHP
<?php
|
|
/**
|
|
* The "Contact" page, mirroring the original contact.html.
|
|
* Template Name: Contact
|
|
*/
|
|
$hl_biz = hogelandlinux_business();
|
|
|
|
$hl_name = isset( $_POST['hl_name'] ) ? sanitize_text_field( wp_unslash( $_POST['hl_name'] ) ) : '';
|
|
$hl_email = isset( $_POST['hl_email'] ) ? sanitize_email( wp_unslash( $_POST['hl_email'] ) ) : '';
|
|
$hl_phone = isset( $_POST['hl_phone'] ) ? sanitize_text_field( wp_unslash( $_POST['hl_phone'] ) ) : '';
|
|
$hl_computer = isset( $_POST['hl_computer'] ) ? sanitize_text_field( wp_unslash( $_POST['hl_computer'] ) ) : '';
|
|
$hl_service = isset( $_POST['hl_service'] ) ? sanitize_text_field( wp_unslash( $_POST['hl_service'] ) ) : '';
|
|
$hl_message = isset( $_POST['hl_message'] ) ? sanitize_textarea_field( wp_unslash( $_POST['hl_message'] ) ) : '';
|
|
|
|
$hl_error = '';
|
|
$hl_success = '';
|
|
|
|
if ( 'POST' === ( $_SERVER['REQUEST_METHOD'] ?? '' ) && isset( $_POST['hl_submit'] ) ) {
|
|
if ( empty( $hl_name ) || ! is_email( $hl_email ) || empty( $hl_message ) ) {
|
|
$hl_error = 'Vul alle verplichte velden in (naam, e-mail, bericht).';
|
|
} else {
|
|
$hl_to = $hl_biz['email'];
|
|
$hl_subject = sprintf( 'Nieuw contactformulier van %s (via %s)', $hl_name, $hl_biz['name'] );
|
|
$hl_body = "Naam: $hl_name\n";
|
|
$hl_body .= "Email: $hl_email\n";
|
|
$hl_body .= "Telefoon: $hl_phone\n";
|
|
$hl_body .= "Computer: $hl_computer\n";
|
|
$hl_body .= "Service: $hl_service\n\n";
|
|
$hl_body .= "Bericht:\n$hl_message\n";
|
|
$hl_headers = array( 'Reply-To: ' . $hl_name . ' <' . $hl_email . '>' );
|
|
|
|
if ( wp_mail( $hl_to, $hl_subject, $hl_body, $hl_headers ) ) {
|
|
$hl_success = 'Bedankt voor uw bericht! Ik neem zo snel mogelijk contact met u op.';
|
|
$hl_name = $hl_email = $hl_phone = $hl_computer = $hl_service = $hl_message = '';
|
|
} else {
|
|
$hl_error = 'Er is een fout opgetreden bij het versturen van uw bericht. Probeer het later opnieuw of stuur direct een e-mail naar ' . $hl_biz['email'] . '.';
|
|
}
|
|
}
|
|
}
|
|
|
|
get_header();
|
|
?>
|
|
|
|
<main>
|
|
<section class="page-hero">
|
|
<div class="container">
|
|
<h1>Neem contact op</h1>
|
|
<p>Heeft u vragen over Linux-migratie? Ik help u graag verder!</p>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="section">
|
|
<div class="container">
|
|
<div class="contact-grid">
|
|
<div class="contact-info">
|
|
<h2>Contactgegevens</h2>
|
|
<div class="contact-item">
|
|
<div class="contact-icon">📍</div>
|
|
<div>
|
|
<h3>Adres</h3>
|
|
<p>Geen bezoekadres: ik doe uitsluitend huisbezoeken</p>
|
|
<p><?php echo esc_html( $hl_biz['street'] ); ?></p>
|
|
<p><?php echo esc_html( $hl_biz['postal'] . ' ' . $hl_biz['village'] ); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="contact-item">
|
|
<div class="contact-icon">📧</div>
|
|
<div>
|
|
<h3>E-mail</h3>
|
|
<p><a href="mailto:<?php echo esc_attr( $hl_biz['email'] ); ?>"><?php echo esc_html( $hl_biz['email'] ); ?></a></p>
|
|
</div>
|
|
</div>
|
|
<div class="contact-item">
|
|
<div class="contact-icon">🏗️</div>
|
|
<div>
|
|
<h3>KvK-nummer</h3>
|
|
<p><?php echo esc_html( $hl_biz['kvk'] ); ?></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="contact-hours">
|
|
<h3>Openingstijden</h3>
|
|
<p>Maandag: 09:00 - 14:00 (op afspraak)</p>
|
|
<p>Dinsdag: 09:00 - 17:00 (op afspraak)</p>
|
|
<p>Woensdag: 09:00 - 14:00 (op afspraak)</p>
|
|
<p>Donderdag: 09:00 - 14:00 (op afspraak)</p>
|
|
<p>Vrijdag: gesloten</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="contact-form">
|
|
<h2>Stuur een bericht</h2>
|
|
|
|
<?php if ( $hl_error ) : ?>
|
|
<div class="alert alert-error">
|
|
<strong>❌ Fout:</strong> <?php echo esc_html( $hl_error ); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ( $hl_success ) : ?>
|
|
<div class="alert alert-success">
|
|
<strong>✅ Gelukt:</strong> <?php echo esc_html( $hl_success ); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<form method="POST" action="<?php echo esc_url( get_permalink() ); ?>">
|
|
<div class="form-group">
|
|
<label for="hl_name">Naam *</label>
|
|
<input type="text" id="hl_name" name="hl_name" value="<?php echo esc_attr( $hl_name ); ?>" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="hl_email">E-mail *</label>
|
|
<input type="email" id="hl_email" name="hl_email" value="<?php echo esc_attr( $hl_email ); ?>" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="hl_phone">Telefoon</label>
|
|
<input type="tel" id="hl_phone" name="hl_phone" value="<?php echo esc_attr( $hl_phone ); ?>">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="hl_computer">Huidige computer</label>
|
|
<input type="text" id="hl_computer" name="hl_computer" value="<?php echo esc_attr( $hl_computer ); ?>" placeholder="Bijv. Dell Inspiron 2015, HP Pavilion 2018">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="hl_service">Gewenste service</label>
|
|
<select id="hl_service" name="hl_service">
|
|
<option value="">Selecteer een optie</option>
|
|
<option value="advice" <?php selected( $hl_service, 'advice' ); ?>>Gratis advies</option>
|
|
<option value="installation" <?php selected( $hl_service, 'installation' ); ?>>Linux-installatie</option>
|
|
<option value="migration" <?php selected( $hl_service, 'migration' ); ?>>Datamigratie</option>
|
|
<option value="training" <?php selected( $hl_service, 'training' ); ?>>Training en ondersteuning</option>
|
|
<option value="other" <?php selected( $hl_service, 'other' ); ?>>Anders</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="hl_message">Bericht *</label>
|
|
<textarea id="hl_message" name="hl_message" rows="5" required placeholder="Vertel iets over uw situatie en hoe ik u kan helpen..."><?php echo esc_textarea( $hl_message ); ?></textarea>
|
|
</div>
|
|
|
|
<button type="submit" name="hl_submit" class="btn btn-primary">Verstuur bericht</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="section section--light-green contact-cta">
|
|
<div class="container">
|
|
<h2>Waarom kiezen voor <?php echo esc_html( $hl_biz['name'] ); ?>?</h2>
|
|
<div class="cta-benefits">
|
|
<div class="card card--cta">
|
|
<div class="card__icon">🎯</div>
|
|
<h3>Persoonlijke aanpak</h3>
|
|
<p>Elke klant is uniek. Ik lever maatwerkoplossingen.</p>
|
|
</div>
|
|
<div class="card card--cta">
|
|
<div class="card__icon">🛠️</div>
|
|
<h3>Professionele service</h3>
|
|
<p>Ruim 20 jaar ervaring met Linux systemen en migraties.</p>
|
|
</div>
|
|
<div class="card card--cta">
|
|
<div class="card__icon">🤝</div>
|
|
<h3>Volledige ondersteuning</h3>
|
|
<p>Van installatie tot training: ik begeleid u door het hele proces.</p>
|
|
</div>
|
|
<div class="card card--cta">
|
|
<div class="card__icon">💚</div>
|
|
<h3>Duurzame keuze</h3>
|
|
<p>U kiest voor een duurzamere digitale toekomst.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
<?php
|
|
get_footer();
|