if ($image_file) {
        list($posterfilename, $posterfilename_error, $posterfilename_msg) = $image_file;
        if (!$posterfilename) {
            $posterfilename_class = "error";
        }
    }
    //outter if statement for poster change
    if ($moviename && $moviecast && $moviedescription && $posterfilename) {
        update_movie($movieid, $moviename, $moviedescription, $moviecast, $posterfilename);
    } else {
        $error_msg = "Please enter required fields.";
    }
}
//post submit
if (isset($_POST["submit"]) && $_POST["submit"] == "Delete Movie") {
    delete_movie($selectedmovie);
    header('Location: movieselection.php');
}
?>
<div class="container">
<br>
<div class="row col-md-4">
<div class="dropdown theme-dropdown clearfix dropdown-toggle input-small" data-toggle="dropdown" role="button" aria-haspopup="true">
	<form method="GET">
	<select name="selectmovie" class="form-control input-small">
		<option value = "">---Select Movie---</option>
			<?php 
$query9 = $mysqli->prepare("SELECT movieid, moviename FROM movie");
$query9->execute();
$query9->bind_result($movieid, $selectmoviename);
while ($query9->fetch()) {
Exemplo n.º 2
0
<?php

include '../common.inc.php';
ini_set("file_uploads", "On");
if (!isset($_SESSION)) {
    session_start();
}
//If a user is not logged in, kick them out of this page
if (!is_logged_in()) {
    header('Location: index.php', 501);
}
//Check the request type
if (isset($_POST['submit'])) {
    //Grab the values from the request, validate and save to DB then redirect to movies page
    if (isset($_POST['movie_id'])) {
        delete_movie($_POST['movie_id']);
        header("Location: movies.php");
    }
} else {
    if (isset($_GET['movie_id'])) {
        echo $twig->render('delete_movie.html.twig', array('is_logged_in' => is_logged_in(), 'user' => get_user_from_session(), 'movie' => get_movie_by_id($_GET['movie_id'])));
    } else {
        header("Location: index.php?error=invalid_movie_id");
    }
}