Ik heb onderstaande script en wil eigenlijk de tabel filteren. Nu heb ik dat middels een href link of moet ik dit met een post (ajax) doen.
[code]
<section id="head">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Lijst met medewerkers</h1>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Categorie
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?categorie=management">Management</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?categorie=verkoop">Verkoop</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?categorie=inkoop">Inkoop</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?categorie=marketing">Marketing</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?categorie=communicatie">Communicatie</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Taal
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?taal=engels">Engels</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?taal=frans">Frans</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?taal=duits">Duits</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?taal=nederlands">Nederlands</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Geslacht
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?geslacht=man">Man</a>
<a class="dropdown-item" href="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>?geslacht=vrouw">Vrouw</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="resultaat">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Overzicht resultaat</h2>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
<th>Medewerker</th>
<th>Woonplaats</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM medewerkers LEFT JOIN medewerkers_talen ON medewerkers_talen.mw_medewerkers_id = medewerkers.medewerkers_id LEFT JOIN medewerkers_geslacht ON mg_medewerkers_id = medewerkers.medewerkers_id GROUP BY medewerkers_id ORDER BY mw_naam ASC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row["medewerkers_id"]. "</td>";
echo "<td>" . $row["mw_naam"]. "</td>";
echo "<td>" . $row["mw_woonplaats"]. "</td>";
echo "</tr>";
}
} else {
echo "0 results";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</section>
[code]
2.108 views