print $vakerror = "missing vak";
            $doorgaan = false;
        } else {
            $vaknaam = strip_tags(trim($_POST["vakNaam"]));
            if (empty($vaknaam)) {
                $doorgaan = false;
                $vaknaamerror = "missing";
            }
        }
        if (!isset($doorgaan)) {
            $doorgaan = true;
        }
        if ($doorgaan == true) {
            // vanaf hier worden alle gegeven verstuurd naar database
            try {
                $vakservice->voegNieuwVakToe($vaknaam, $klasid);
                header("location:vakkentoevoegen.php?gelukt=true");
                exit(0);
            } catch (vakbestaatexception $vbe) {
                header("location:vakkentoevoegen.php?error=vakbestaat");
                exit(0);
            }
        }
    } else {
        include "presentation/vakkentoevoegenpres.php";
    }
    if (isset($_GET["gelukt"]) && $_GET["gelukt"] == "true") {
        echo '<div id="dialog" title="Vak toegevoegd">Vak is toegevoegd</div>';
    }
} else {
    header("location: home.php");