forked from ITArif/Online-Movie-Ticket-Booking-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
movie.php
73 lines (57 loc) · 2.15 KB
/
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
<?php
include_once "connection/conn.php";
?>
<?php include_once "file/header.php"; ?>
<section class="contentsection clear">
<?php include_once "file/sidebar.php"; ?>
<article class="maincontent clear">
<div class="content">
<h2>Add Movie & Image</h2>
<?php
if ($_SERVER["REQUEST_METHOD"]=="POST") {
$mname=$_POST["mname"];
$image =$_FILES['image']['name'];
$image_temp=$_FILES["image"]["tmp_name"];
$uploadimage="common/images/".$image;
if (empty($mname) || empty($image)) {
echo "Nothing empty";
}else{
$sql="SELECT * FROM tbl_movie where movie_name='$mname'";
$query=mysqli_query($connection,$sql);
$row=mysqli_num_rows($query);
if ($row<1) {
move_uploaded_file($image_temp, $uploadimage);
$sql="INSERT INTO tbl_movie (movie_name,image) VALUES('$mname','$uploadimage');";
$query=mysqli_query($connection,$sql);
if ($query) {
echo "Info is inserted";
}
}else{
echo "exist";
}
}
}
?>
<form action="" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>Movie Name</td>
<td><input type="text" name="mname" placeholder="Movie Name"/></td>
</tr>
<tr>
<td>Image</td>
<td><input type="file" name="image"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Add"/></td>
</tr>
</table>
</form>
</div>
</article>
</section>
<?php include_once "file/footer.php"; ?>
</div>
</body>
</html>