x108/J1.php

<?php $achternaam = $_POST['achternaam'] ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <script href='ajax.js'></script> </head> <body> <?php include ('db.php'); echo "<form action='' method='post'>"; echo "<input type='text' name='achternaam' placeholder='achternaam' value='$achternaam'>"; echo "<input type='submit' value='Zoeken'>"; echo "</form>"; echo '<br><br><br>'; $query = "select * from leerlingen where achternaam like '%$achternaam%'"; $result = mysqli_query($db,$query) or die(mysqli_error($db)); while($row = mysqli_fetch_array($result)){ echo "<div>$row[voornaam] $row[tussenvoegsel] $row[achternaam]</div>"; } ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse