M1_1.php

<?php include "db.php"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> td{ border: 1px solid black; width: fit-content; height: 30px; } </style> </head> <body> <script src="ajax.js"></script> <select> <?php $result = mysqli_query($db, "SELECT voornaam, tussenvoegsel, achternaam, auteurnr FROM auteurs"); while($row = mysqli_fetch_array($result)){ echo "<option value='$row[3]'>$row[0] $row[1] $row[2]</option>"; } ?> </select> <table id="table"></table> <script> document.querySelector("select").oninput = function(){ ajax("M1_2.php?auteurnr=" + document.querySelector("select").value, "table") } </script> </body> </html>

Resultaat

Made by Thijs Aarnoudse