-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_movie.php
71 lines (56 loc) · 2.54 KB
/
create_movie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
// Include DB connection
include 'database.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$title = $_POST['title'];
$description = $_POST['description'];
$language = $_POST['language'];
$year = $_POST['year'];
$director = $_POST['director'];
$category = $_POST['category'];
$length = $_POST['length'];
$image = $_POST['image']; // Changed input from file to text
// SQL query to insert the movie into the database
$query = "INSERT INTO movies (title, description, language, year, director, category, image , length)
VALUES ('$title', '$description', '$language', '$year', '$director', '$category', '$image', '$length')";
if (mysqli_query($conn, $query)) {
echo "<script>alert('Movie added successfully');</script>";
} else {
echo "Error: " . $query . "<br>" . mysqli_error($conn);
}
}
?>
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Movie</title>
<link rel="stylesheet" href="styles.css">
</head>
<body style=" background-image: url('netflix.jpg');">
<div class="create-movie-form" style="background-color: #1f1f1feb;">
<h2>Create Movie</h2>
<form action="create_movie.php" method="post" enctype="multipart/form-data">
<label for="name">Movie Name:</label>
<input type="text" name="title" id="name" required><br>
<label for="description">Description:</label>
<textarea name="description" id="description"></textarea><br>
<label for="language">Language:</label>
<input type="text" name="language" id="language"><br>
<label for="year">Year:</label>
<input type="text" name="year" id="year"><br>
<label for="length">Length (in minutes)</label>
<input type="text" name="length" id="length" placeholder="Enter film length in hours,minutes" required> <!-- New input for film length -->
<label for="director">Director:</label>
<input type="text" name="director" id="director"><br>
<label for="category">Category:</label>
<input type="text" name="category" id="category"><br>
<label for="poster">Movie Poster: (URL or file path)</label>
<input type="text" name="image" id="poster_path" placeholder="Enter image URL or file path" required> <!-- Changed to text input -->
<button type="submit">Create Movie</button>
</form>
</div>
</body>
</html>