In this assignment you will combine HTML, PHP, and SQL in order to create a web form that allows a manager to add films to the sakila database. You will also create a method to allow the manager to view a list of all films along with their related information, and a list of actors in the movies.

  1. Create an initial HTML page titled manager.html with 2 buttons. The first button will be labeled “View Films”, and the second button will be labeled “Add Film”. The first button should link to a file titled view_films.php. The second button should link to a file titled add_film.html.
  2. Create the view_films.php file. This file should generate an html page that contains a table that lists all of the flims in the film table from the sakila database. You should list the following information about each film: title, description, rating, rental duration, rental_rate, length, category, and a list of actor names (first, last) that appear in the movie. This page should have a button that returns you to the manager.html page. The last column in your table will be a string containing all the actor names … you do not need a different cell for each actor name because the number of actors in each movie is not the same. Use a comma to separate actor names. (I suggest working on adding the actor names last, as this is the most complicated step). You can also use the Film “title” as the key to an associative array since each title is unique.
  3. Create the add_film.html file. It should have a form with text boxes to input the following information about a new flim: title, description, release_year, language_id, rental_duration, rental_rate, length, replacement_cost, rating, special_features. “rating” should be a drop down box with only the following values: G, PG, PG-13, R, NC-17. “special features” should be a drop down box with only the following values: Trailers, Commentaries, Deleted Scenes, Behind the Scenes. You do not need to do error checking on the input (i.e. verify that cost is a number), but be aware that if you don’t enter the correct data type your query may fail. So use good data for testing. You will need two buttons on this page, save and cancel. The save button will need to insert the employee information into the database as described below (by linking to a file titled add_film.php), display a message stating whether the query was successful or not, and display button to return to the manager.html page. The cancel button will simply need to return to the manager.html page.
  4. Create the add_film.php file.   Here is a sample query that does the work for you: INSERT INTO sakila.film (title,description,release_year,language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features) VALUES (‘1st Grade FBI Agent’,’An undercover FBI agent must pretend to be a 1st grade teacher to catch the bad guy’,2014,2,5,4.99,123,20.99,’PG-13′,’trailers’);
  5. You will need to use the query above as a guide to use inputs from the $_POST array to insert into the database. Your add_film.php page should display success if the film was added, or an error message if the insertion failed. You should also have a button linking back to the manager.html page.



Source link

Leave a Reply

Your email address will not be published.