Esempio n. 1
0
$bands = new Bands();
//Define variables
$naam = $genre_id = $website = $woonplaats = $telefoon = "";
//Haal genres op
$genres = new Genres();
$genres = $genres->get_all();
//Check of er POST waarde is
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    //Valideer post attr
    if ($_POST && isset($_POST['naam'], $_POST['genre'], $_POST['website'], $_POST['woonplaats'], $_POST['telefoon'])) {
        $naam = test_input($_POST['naam']);
        $genre_id = test_input($_POST['genre']);
        $website = test_input($_POST['website']);
        $woonplaats = test_input($_POST['woonplaats']);
        $telefoon = test_input($_POST['telefoon']);
        $band = $bands->add($naam, $genre_id, $website, $woonplaats, $telefoon, $usr['id']);
        if ($band) {
            $band = $bands->get($band);
            if ($band) {
                ?>
                <script>
                    $.notify("Band is succesvol aangemaakt!", "success");
                </script>
                <?php 
            } else {
                ?>
                <script>
                    $.notify("Band kon niet worden aangemaakt", "error");
                </script>
            <?php 
            }