function find_selected_film() { /* This allows me to call a films name, genre, etc. as a variable when the id has been passed to the url. If there is no id in the url, it will randomly generate one. It is super useful in recommend.php, as it ensure that a film will always be displayed on the page. */ global $current_film; global $film_name; global $release_date; global $genre; global $summary; global $wrote; global $acted; global $directed; global $runtime; global $female_lead; global $male_lead; global $quote; global $image_location; if (isset($_GET["film"])) { $current_film = get_film_by_id($_GET["film"]); $film_name = htmlentities($current_film["film_name"]); $release_date = htmlentities($current_film["release_date"]); $genre = ucwords($current_film["genre"]); $summary = htmlentities($current_film["summary"]); $wrote = htmlentities(binary_to_words($current_film["wrote"])); $acted = htmlentities(binary_to_words($current_film["acted"])); $directed = htmlentities(binary_to_words($current_film["directed"])); $runtime = htmlentities($current_film["runtime"]); $female_lead = htmlentities($current_film["female_lead"]); $male_lead = htmlentities($current_film["male_lead"]); $quote = htmlentities($current_film["quote"]); $image_location = htmlentities($current_film["image_location"]); } else { $random_film_id = generate_random_id(); $new_address = "recommend.php?film=" . $random_film_id; redirect_to($new_address); } }
<?php require_once "config.php"; require_once "functions.php"; $id = null; if (isset($_GET["id"])) { $id = $_GET["id"]; } $film = get_film_by_id($id); echo $film; ?> <!DOCTYPE> <html> <head> <title>PHP - P20</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <style>.img-mov {height: 300px;} .col-md-3 {margin-bottom: 15px;}</style> </head> <body> <div class="col-md-12"> <h1>Question 2</h1> <hr /> <form method="post" action=""> <input placeholder="Année" type="text" name="annee" /> <button type="submit">Soumettre</button> </form> <hr /> <div class="container"> <div class="row">