//voor het aanroepen van delete dat in de delete knop zit.
if (isset($_GET["action"]) && $_GET["action"] == "delete") {
    $filmGegevens->verwijder($_GET["id"]);
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <h1>Alle films</h1>
        <?php 
//maak een lijst aan
$tab = $filmGegevens->getLijst();
//voor elke film in de tabel word de titel opgeroepen en de duurtijd.
//De delete knop heeft een link waarin een action delete staat met een dynamisch ID
//het id komt uit film
foreach ($tab as $film) {
    echo $film->getTitel() . " - " . $film->getDuurtijd() . " - ";
    ?>
 
        min <a href="93filmOverzicht.php?action=delete&id=<?php 
    echo $film->getId();
    ?>
">
             <img src="delete.png" alt=""/></a><br>
             
          <?php 
}
        $dbh = null;
        return $lijst;
    }
}
$filmlijst = new FilmLijst();
if (isset($_GET["action"]) && $_GET["action"] == "new") {
    $filmlijst->createFilm($_POST["titel"], $_POST["duurtijd"]);
}
?>
<!DOCTYPE HTML>
<html>
	<head><title>Films</title></head>
	<body>
		<h1>Alle films</h1>
		<?php 
$tab = $filmlijst->getLijst();
?>
		<ul>
			<?php 
foreach ($tab as $film) {
    print "<li>" . $film . "</li>";
}
?>
		</ul>
		<h1>Film toevoegen</h1>
		<form action="films.php?action=new" method="post">
			Titel:
			<input type="text" name="titel"><br><br>
			Duurtijd:
			<input type="text" name="duurtijd"> minuten<br>
			<input type="submit" value="Toevoegen">
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>filmoverzicht</title>
        <style>
            span, input {margin-bottom: 0.5em; margin-top: 0.5em;}
        </style>
    </head>
    <body>
        <h1>Alle Films</h1>
        <?php 
$pl = new FilmLijst();
$tab = $pl->getLijst();
?>
		<ul>
			<?php 
foreach ($tab as $naam) {
    print "<li>" . $naam . "</li>";
}
?>
		</ul>
        <h1>Film toevoegen</h1>
        <form action="alleFilmsLijstEnForm.php" method="post">
            <span>Titel: <input type="text" name="filmtitel" placeholder="filmtitel" autofocus=""></span>
                </br>
                <span>Duurtijd: <input type="text" name="duurtijd" placeholder="duurtijd"> minuten</span>
                </br>
                <input type="submit" value="Toevoegen" name="submit">
Beispiel #4
0
if (isset($_GET["action"]) && $_GET["action"] == "delete") {
    $fl->deleteFilm($_GET["id"]);
}
?>

<!DOCTYPE HTML>
<html>
<head>
	<meta charset=utf-8>
	<title>Films</title>
</head>
<body>
	<h1>Alle films</h1>
	<ul>
		<?php 
$tab = $fl->getLijst();
foreach ($tab as $film) {
    ?>
				<li>
					<a href="filmbewerken.php?id=<?php 
    print $film->getId();
    ?>
">
					<?php 
    print $film->getTitel();
    ?>
					</a>
					(<?php 
    print $film->getDuurtijd();
    ?>
 min)