Example #1
0
    header("Location:index.php");
    exit;
}
?>

<?php 
if (isset($_POST['update_title_query'])) {
    $db = new Database();
    $movie = new Movie($db);
    $selected = substr($_POST['update_title'], 1, -1);
    $movie->setId($selected);
    $rows = $movie->find_movie_by_id();
    if (is_array($rows)) {
        try {
            $view = new View();
            $view->view_selected_movie($rows);
        } catch (Exception $e) {
            echo "Error: {$e->getMessage()}";
        }
    } else {
        throw new Exception("Error: Please contact the tech guys.");
    }
    $db = NULL;
}
if (isset($_POST['update_movie'])) {
    $db = new Database();
    $movie = new Movie($db);
    $selected = $_POST['movie_id'];
    $movie->setId($selected);
    $movie->setTitle($_POST['movie-title']);
    $movie->setDirector($_POST['movie-director']);