<?php

require_once "film.class.php";
require_once "filmlijst.class.php";
if ($_GET["action"] == "verwerk") {
    $film = new Film($_GET["id"], $_POST["titel"], $_POST["duurtijd"]);
    $filmLijst = new FilmLijst();
    $filmLijst->updateFilm($film);
    $updated = true;
}
?>
<!DOCTYPE HTML>
<html>
	<head><title>Films</title></head>
	<body>
		<h1>Film bewerken</h1>
		<?php 
if ($updated) {
    print "Record bijgewerkt!";
}
$filmLijst = new FilmLijst();
$film = $filmLijst->getFilmById($_GET["id"]);
?>
		<form action="filmbewerken.php?action=verwerk&id=<?php 
print $_GET["id"];
?>
" method="post">
			Titel:
			<input type="text" name="titel" value="<?php 
print $film->getTitel();
?>
<?php

//filmsBewerken.php
require_once 'FilmLijst_oplossingenboek.php';
$updated = false;
if (isset($_GET["action"]) && $_GET["action"] == "verwerk") {
    $fiml = new Film($_GET["id"], $_POST["titel"], $_POST["duurtijd"]);
    $fLijst = new FilmLijst();
    $fLijst->updateFilm($fiml);
    $updated = true;
}
?>


 
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Gegevens bewerken</title>
        <style>
            input {margin-top: 0.5em; margin-bottom: 0.5em;}
            #Back {display: block; margin-top: 2em; }
            input:focus {background-color: yellow;}
        </style>
    </head>
    <body>
        <h1>Film bijwerken</h1>
		<?php 
if ($updated) {
    print "Record bijgewerkt!";