Task 1 1 Create an initial HTML page titled movieshtml with
Solution
I try to give you max things you want you just need to create dbLink for your database and pass it to $dbLink variable you\'re all task will work:-
<!--movie.html-->
<html>
<head> </head>
<title>Movie </title>
<body>
<br><br>
<center>
<form name =\"viewmovie\" action = \"./view_movie.php\">
<input type = \"submit\" name=\"View Movie\" value =\"View Movie\">
</form>
<br><br>
<form name =\"addactor\" action = \"./add_actor.html\">
<input type = \"submit\" name=\"Add Actor\" value =\"Add Actor\">
</form>
</center>
</body>
</html>
<!--add_actor.html-->
<html>
<head> </head>
<title>Movie </title>
<body>
<br><br>
<center>
<form name =\"viewmovie\" action = \"./insertactor.php\">
<h3>Please Enter Actor Information </h3>
Actor First Name : <input type =\"text\" name =\"fname\" value =\"\"> <br><br>
Actor Last Name : <input type =\"text\" name =\"lname\" value =\"\">
<br><br><br>
<input type = \"submit\" name=\"Save\">
<input type= \"button\" name =\"Cancel\" value =\"Cancel\" onClick=\"window.open(\'./movie.html\')\">
</form>
</center>
</body>
</html>
<!--insert_movie.php-->
<html>
<body>
<?php
$query = \"SELECT * FROM film order by title\";
$result = mysql_db_query($mysql_database,$query,$dblink);
if($result && mysql_num_rows($result)) {
$details=\"<table>\";
$details.= \"<thead><tr><th>Title</th><th>Description</th><th>Length</th><th>Rating</th></tr></thead><tbody>\";
while($row = mysql_fetch_array($result)) {
$details.=\"<tr>\";
$title = $row[\'title\'];
$description=$row[\'Description\'];
$length = $row[\'Length\'];
$rating = $row[\'Rating\'];
$details.=\"<td>$title</td>\";
$details.=\"<td>$description</td>\";
$details.=\"<td>$length</td>\";
$details.=\"<td>$rating</td>\";
$details.= \"</tr>\";
}
$details.= \"</tbody></table>\";
}
echo \"$details\";
?>
<input type= \"button\" name =\"Back\" value =\"Back\" onClick=\"window.open(\'./movie.html\')\">
</body>
</html>
<!-- insert_actor.php-->
<?php
$fname = $_REQUEST[\'fname\'];
$lname = $_REQUEST[\'lname\'];
$query = \"INSERT INTO actor (fname,lname) VALUES (\'$fname\',\'$lname\');\";
$result= @mysqli_query($dbLink,$query);
if(@mysqli_affected_rows($dbLink) > 0){
$opstatus = 1;
$message =\"Actor Added successfully.\";
}
else{
$opstatus = 0;
$message =\"Insertion failed\";
}
?>
<html>
<body>
<h5>
<?$message;?>
</h5>
<?php
if($opstatus){
$query = \"SELECT * FROM actor order by title\";
$result = mysqli_query($dbLink,$query);
if($result && mysqli_num_rows($result)) {
$details=\"<table>\";
$details.= \"<thead><tr><th>Title</th><th>Description</th><th>Length</th><th>Rating</th></tr></thead><tbody>\";
while($row = mysqli_fetch_array($result)) {
$details.=\"<tr>\";
$title = $row[\'title\'];
$description=$row[\'Description\'];
$length = $row[\'Length\'];
$rating = $row[\'Rating\'];
$details.=\"<td>$title</td>\";
$details.=\"<td>$description</td>\";
$details.=\"<td>$length</td>\";
$details.=\"<td>$rating</td>\";
$details.= \"</tr>\";
}
$details.= \"</tbody></table>\";
}
echo \"$details\";
}
?>
<input type= \"button\" name =\"Back\" value =\"Back\" onClick=\"window.open(\'./movie.html\')\">
</body>
</html>



