hip1/16.2/main.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> <link href="ajax.css" rel="stylesheet" type="text/css"> <script src="ajax.js"></script> <script> window.onload = starten; function starten(){ document.getElementById('submitbutton').onclick = boekenlijst; } function uitleningen(lijst){ var id = lijst.options[lijst.selectedIndex].value ajax('uitleningen.php?boeknr=' + id,'boekuitlening') } function boekenlijst(){ var leerling = document.getElementById('llnr') var llnr = leerling.options[leerling.selectedIndex].value var boek = document.getElementById('boeknr') var boeknr = boek.options[boek.selectedIndex].value ajax('info.php?llnr='+llnr+'&boeknr='+boeknr,'boekenleerling') } </script> </head> <body> <div id='container'> <div id='right'> <div id='ajax'> <h3 align="center">A.J.A.X.</h3> <p align="right"><input type="checkbox" id='alertRespons'>Alert antwoord</p> <div id='ajaxtext'></div> </div> </div> <?php include("../db.php"); $query = "select * from leerlingen order by achternaam, voornaam, llnr"; $result = mysqli_query($db, $query) or die(mysqli_error($db)); echo "<p><span class='label'>Naam :</span> <span class='info'><select name='leerling' id='llnr'><option value=''></option>"; while ($row = mysqli_fetch_array($result)){ echo "<option value=$row[llnr]>$row[achternaam], $row[voornaam]</option>"; } echo "</select></span></p>"; $query = "select * from boeken order by titel, boeknr"; $result = mysqli_query($db, $query) or die(mysqli_error($db)); echo "<p><span class='label'>Boek :</span> <span class='info'><select name='boek' id='boeknr'><option value=''></option>"; while ($row = mysqli_fetch_array($result)){ echo "<option value=$row[boeknr]>$row[titel]</option>"; } echo "</select></span> <input type='button' id='submitbutton' value='Verzenden'></input></p>"; echo "<div id='boekenleerling'></div>"; //include('info.php'); ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse