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.
Task 1
Task 2
Task 3
manager.html
<!DOCTYPE html>
<html>
<head>
<title>Film data</title>
<link rel="stylesheet" type="text/css"
href="bootstrap.min.css">
<!--Please download bootstrap.min.css form internet
-->
</head>
<body>
<div class="container" style="margin-top:
50px;">
<div class="row">
<div
class="col-md-3"></div>
<div
class="col-md-3">
<a href="view_films.php" class="btn
btn-primary">View Films</a>
</div>
<div
class="col-md-3">
<a href="add_film.html" class="btn
btn-primary">Add film</a>
</div>
</div>
</div>
</body>
</html>
view_films.php
<!DOCTYPE html>
<html>
<head>
<title>Films list</title>
<link rel="stylesheet" type="text/css"
href="bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<?php
$conn =
mysqli_connect("localhost","root","your_password","sakila");
$sql = "SELECT * FROM film";
$query = mysqli_query($conn,$sql);
$total = mysqli_num_rows($query);
$res='';
if($total>0){?>
<table class="table table-striped
table-bordered table-hover table-checkable order-column">
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th>Release Year</th>
<th>Language Id</th>
<th>Rental Duration</th>
<th>Rental rate</th>
<th>Lenght</th>
<th>Replacement cost</th>
<th>Rating</th>
<th>Special Features</th>
<th>Actors</th>
</tr>
</thead>
<?php
while($row=mysqli_fetch_assoc($query)){
?>
<tr>
<td><?php echo
$row["title"];?></td>
<td><?php echo
$row["description"];?></td>
<td><?php echo
$row["release_year"];?></td>
<td><?php echo
$row["language_id"];?></td>
<td><?php echo
$row["rental_duration"];?></td>
<td><?php echo
$row["rental_rate"];?></td>
<td><?php echo
$row["length"];?></td>
<td><?php echo
$row["replacement_cost"];?></td>
<td><?php echo
$row["rating"];?></td>
<td><?php echo
$row["special_features"];?></td>
<td><?php echo
$row["actors"];?></td>
</tr>
<?php
}
}
else{
echo "<h1>There no
records found</h1>";
}
?>
</div>
</div>
</body>
</html>
add_film.html
<!DOCTYPE html>
<html>
<head>
<title>Adding film</title>
<link rel="stylesheet" type="text/css"
href="bootstrap.min.css">
<style type="text/css">
.name{
font-size:
20px;
color:blue;
font-weight:
bold;
font-family:
sans-serif;
margin-top:
2px;
}
</style>
<script type="text/javascript">
function validate(){
var release_year
= $("#release_year").val();
var language
=$("#language").val();
var rental_d =
$("#rental_d").val();
var rental_r =
$("#rental_r").val();
var length
=$("#length").val();
var repla_cost =
$("#repla_cost").val();
if(!isNaN(release_year) && !isNaN(language) &&
!isNaN(rental_r) && !isNaN(rental_d) &&
!isNaN(length) && !isNaN(repla_cost)){
return true;
}
else{
$("#error").slideDown();
$("#error").slideUp(4000);
return false;
}
}
</script>
</head>
<body>
<div class="container" style="margin-top:
50px;">
<div class="alert alert-danger"
style="display:none" id="error"><center><b>**Please
Filled Out All the
details**</b></center></div>
<form action="add_film.php"
method="post" onsubmit="return validate()">
<center>
<div class="form-group">
<h1>Adding
film</h1>
<table>
<tr>
<td><p class="name">Title:
</p> </td>
<td><input type="text" name="title"
class="form-control" required=""></td>
</tr>
<tr>
<td><p class="name">Description:
</p> </td>
<td><input type="text" name="desc"
class="form-control" required=""></td>
</tr>
<tr>
<td><p class="name">Release Year:
</p> </td>
<td><input type="text"
name="release_year" class="form-control" required=""
id="release_year"></td>
</tr>
<tr>
<td><p class="name">Language id:
</p> </td>
<td><input type="text" name="language"
class="form-control" required="" id="language"></td>
</tr>
<tr>
<td><p class="name">Rental Duration:
</p> </td>
<td><input type="text" name="rental_d"
class="form-control" required="" id="rental_d"></td>
</tr>
<tr>
<td><p class="name">Rental Rate:
</p> </td>
<td><input type="text" name="rental_r"
class="form-control" required="" id="rental_r"></td>
</tr>
<tr>
<td><p class="name">Length:
</p> </td>
<td><input type="text" name="length"
class="form-control" required="" id="length"></td>
</tr>
<tr>
<td><p class="name">Replacement
Cost: </p> </td>
<td><input type="text"
name="repla_cost" class="form-control" required=""
id="repla_cost"></td>
</tr>
<tr>
<td><p class="name">Rating:
</p> </td>
<td>
<select type="text"
name="rating" class="form-control">
<option
value="g">G</option>
<option
value="pg">PG</option>
<option
value="pg13">PG-13</option>
<option
value="r">R</option>
<option
value="nc17">NC-17</option>
</select>
</td>
</tr>
<tr>
<td><p class="name">Special
features: </p> </td>
<td>
<select name="spe_fea"
class="form-control">
<option
value="trailers">Trailers</option>
<option
value="Commentaries">Commentaries</option>
<option
value="del_sce">Deleted Scenes</option>
<option
value="behind_sce">Behind the Scenes</option>
</select>
</td>
</tr>
<tr>
<td><p class="name">Actors:
</p></td>
<td><input type="text" name="actors"
class="form-control" placeholder="Actors name divided by
,"></td>
</tr>
<tr>
<td><button class="btn btn-primary"
name="sumbit"
type="submit">Sumbit</button></td>
<td><a href="manager.html" class="btn
btn-primary">Cancel</a></td>
</tr>
</table>
</div>
</center>
</form>
</div>
</body>
</html>
add_film.php
<link rel="stylesheet" type="text/css"
href="bootstrap.min.css">
<?php
$conn =
mysqli_connect("localhost","root","your_password","sakila");
if($_SERVER["REQUEST_METHOD"]=="POST"){
$file_title =
$_POST["title"];
$description =
$_POST["desc"];
$rel_year =
$_POST["release_year"];
$lan_id=$_POST["language"];
$ren_dur =
$_POST["rental_d"];
$ren_rate
=$_POST["rental_r"];
$len = $_POST["length"];
$rep_cost =
$_POST["repla_cost"];
$film_rat = $_POST["rating"];
$file_features =
$_POST["spe_fea"];
$actors = $_POST["actors"];
$sql = "INSERT INTO
film(title,description,release_year,language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,actors)
values('".$file_title."','".$description."','".$rel_year."','".$lan_id."','".$ren_dur."','".$ren_rate."','".$len."','".$rep_cost."','".$film_rat."','".$file_features."','".$actors."')";
//$query =
mysqli_query($conn,$sql);
if(mysqli_query($conn,$sql)){
echo
'<script>alert("Film data successfully
inserted");</script><center><a href="manager.html"
class="btn btn-primary">Goto
Back</a></center>';
}
else{
echo
"<script>alert('Erro in
insertion');window.location='add_film.html';</script>";
}
}
?>
In this assignment you will combine HTML, PHP, and SQL in order to create a web...
SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...
Create web pages for your database using PHP. You should have one page that will return all the information from the database. You should create additional pages that will allow you to do various queries of your database. You should be able to retrieve and insert data; also include functionality to delete data from your database. Create an html form that will allow you to enter in new information for the database. The information should be handled by a PHP...
Place an e-iall k t0 yuIJU 6. Create a web page about your favorite sports team with a two-column table that list the positions and starting players. Use embedded CSS to style the table border, back ground color, and center the table on the web page. Place an e-mail link to yourself n the web page. Save the file as sport8.html. 7. Create a web page about your favorite movie that uses a two-column table contain- ing details about the...
PHP Programming In this project, you will create a Web page that allows visitors to your site to sign a guest book that is saved to a database. Create a new document in your text editor and type the <!DOCTYPE> declaration, <html> element, document head, and <body> element. Use the strict DTD and “Guest Book” as the content of the <title> element. Add the following text and elements to the document body: <h2>Enter your name to sign our guest book</h2>...
already created table now need php and html Write SQL statements to delete the above table. 3. PHP with html Write the html code to allow a user to enter a SUP_ID from the sunnysdiner database available on the same scrver. Then write the separate file with PHP script should display all the supplier's information from the supplier table with proper error handling. html file: a) use sunnysdiner; CREATE TABLE supplier ( food_item varchar(30) not null primary ley, SUP_ID INT,...
Using HTML and JavaScript. For this assignment you should submit a single zip file that contains the following two files: index.html script.js index.html should be a skeleton HTML page. So it should have the following tags: doctype html head meta title body script If you were to open index.html without including the associated JavaScript it should be entirely blank. You should then use JavaScript to create all of the content of this page and append it to the body of...
Project Description Complete the Film Database program described below. This program allows users to store a list of their favorite films. To build this program, you will need to create two classes which are used in the program’s main function. The “Film” class will store information about a single movie or TV series. The “FilmCollection” class will store a set of films, and includes functions which allow the user to add films to the list and view its contents. IMPORTANT:...
PHP you need to create a form to allow the user to enter their name, email, and address information. That information will be sent to a PHP script that will process and display that information. Your assignment should have two pages. The first page is straight html (user_input.html) that has a form with the appropriate form elements to collect the user input. The form should then be submitted using the POST method to a php script (display_user_info.php) that will process...
In this problem, you will create a selectable “To Do” List. To add a task to this list, the user clicks the Add Task button and enters a description of the task. To delete a task from the list, the user selects the task and then clicks the Delete Task button. Open the HTML and JavaScript files provided as start-up files (index.html from within todo_list_Q.zip file). Then, review the HTML in this file. Note, within the div element, there is...
You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...