Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
require_once 'config.php';
include_once 'class/class.php';
$zoekterm = isset($_GET['zoekterm']) ? htmlspecialchars($_GET['zoekterm']) : '';
$selectedLocation = isset($_GET['location']) ? $_GET['location'] : '';
$selectedEigenschap = isset($_GET['eigenschap']) ? $_GET['eigenschap'] : '';
// Haal alle liggingen en eigenschappen op
$sql = "SELECT name FROM locations";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$locations = $stmt->fetchAll();
$sql = "SELECT name FROM eigenschappen";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$eigenschappen = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Villa Verkenner - Aanbod</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<div class="container">
<nav>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="Aboutus.html">Over Ons</a></li>
<li><a href="aanbod.php">Aanbod</a></li>
<li class="login-signup">
<a href="login.php">Inloggen</a>
<a href="register.php">Aanmelden</a>
</li>
</ul>
</nav>
</div>
</header>
<section class="featured-properties">
<div class="container">
<div class="title-aanbod">
<h2>Uitgelichte Huizen</h2>
</div>
<section class="filter-options">
<div class="container-filter">
<!-- Gecombineerde filterformulieren -->
<form method="GET" action="aanbod.php" class="filter-form" id="filterForm">
<!-- Filter op ligging -->
<div class="filter-group">
<label for="location">Filter op ligging:</label>
<select name="location" id="location">
<option value="">Alle Locaties</option>
<?php
foreach ($locations as $location) {
echo '<option value="' . $location['name'] . '" ' . ($selectedLocation == $location['name'] ? 'selected' : '') . '>' . $location['name'] . '</option>';
}
?>
</select>
</div>
<!-- Filter op eigenschap -->
<div class="filter-group">
<label for="eigenschap">Filter op eigenschap:</label>
<select name="eigenschap" id="eigenschap">
<option value="">Alle Eigenschappen</option>
<?php
foreach ($eigenschappen as $eigenschap) {
echo '<option value="' . $eigenschap['name'] . '" ' . ($selectedEigenschap == $eigenschap['name'] ? 'selected' : '') . '>' . $eigenschap['name'] . '</option>';
}
?>
</select>
</div>
<!-- Zoek op prijs -->
<div class="filter-group">
<label for="min-prijs">Zoek op prijs:</label>
<input type="number" name="min_price" id="min_price"
placeholder="Minimale prijs"
value="<?= htmlspecialchars($_GET['min_price'] ?? '') ?>">
<input type="number" name="max_price" id="max_price"
placeholder="Maximale prijs"
value="<?= htmlspecialchars($_GET['max_price'] ?? '') ?>">
</div>
<!-- Zoek op plaatsnaam -->
<div class="filter-group">
<label for="zoekterm">Zoek op plaatsnaam:</label>
<input type="text" name="zoekterm" id="zoekterm"
placeholder="Plaatsnaam"
value="<?= htmlspecialchars($_GET['zoekterm'] ?? '') ?>">
</div>
<!-- Filter en Clear knop -->
<div class="filter-buttons">
<button class="more-info" type="submit">Filter</button>
<button class="more-info" type="button" onclick="clearFilters()">Clear Filters</button>
</div>
</form>
</div>
</section>
<div class="huis-list">
<?php
functions::showAllVillas();
?>
</div>
</div>
</section>
</body>
<script src="script.js"></script>
<script>
function clearFilters() {
// Reset het formulier
document.getElementById("filterForm").reset();
// Verwijder de URL-parameters en laad de pagina opnieuw
window.location.href = window.location.pathname;
}
</script>
</html>