K1.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>
</head>
<body>
<?php
include('db.php');
if(isset($_GET['auteur'])){
$auteurnr = $_GET['auteurnr'];
$query = "select *
from auteurs
where auteurnr = '$auteurnr'";
$result = mysqli_query($db, $query) or die(mysqli_error($db));
$row = mysqli_fetch_array($result);
}
echo "<form action='' method='get'>";
echo "<select name='auteur'>";
echo "<option value=''></option>";
echo "option value='auteurnr'>$row[voornaam]</option>";
/*while($row=mysqli_fetch_array($result)){
echo "<option value='auteurnr'>$row[voornaam] $row[tussenvoegsel] $row[achternaam]</option>";
}*/
echo "</select>";
echo "";
$query = "select *
from auteurs
order by auteurnr";
$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