-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgallery_edit.php
More file actions
154 lines (126 loc) · 6.14 KB
/
gallery_edit.php
File metadata and controls
154 lines (126 loc) · 6.14 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
include("connect.php");
$gallery_id = $_REQUEST['gallery_id'];
$query = "SELECT * from gallery where gallery_id='" . $gallery_id . "'";
$result = mysqli_query($con, $query) or die(mysqli_error($con));
$row = mysqli_fetch_assoc($result);
$p1 = $row['photo1'];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>gallery_edit</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<style>
body {
background-color: #000000;
color: #ffffff;
}
.myform {
display: flex;
justify-content: center;
border-radius: 30px 30px;
margin: 50px 320px;
border: 1px solid white;
background-color: #000000;
}
.myform h1 {
padding-bottom: 10px;
padding-top: 10px;
}
.myform label {
font-size: 20px;
font-weight: 600;
}
.tabledata {
padding-top: 10px;
padding-bottom: 10px;
padding-right: 10px;
}
.tabledata img {
margin-left: 30px;
width: 180px;
height: 70px;
}
#inputbox {
width: 160%;
}
.other-link a {
margin: 5px 30px;
text-decoration: none;
text-transform: uppercase;
padding: 13px 25px;
background-color: #198754;
color: white;
border-radius: 8px;
font-size: 19px;
transition: background-color 0.3s;
}
.other-link a:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="myform">
<?php
$status = "";
if (isset($_POST['new']) && $_POST['new'] == 1) {
$gallery_id = $_REQUEST['gallery_id'];
$photo_title = $_REQUEST['photo_title'];
$photo1 = $_REQUEST['photo1'];
$photo2 = $_REQUEST['photo2'];
$photo3 = $_REQUEST['photo3'];
$photo4 = $_REQUEST['photo4'];
$update = "update gallery set photo_title='" . $photo_title . "',photo1='" . $photo1 . "',photo2='" . $photo2 . "',photo3='" . $photo3 . "',photo4='" . $photo4 . "'where gallery_id='" . $gallery_id . "'";
mysqli_query($con, $update) or die(mysqli_error($con));
$status = "Photo Updated Successfully.</br></br>";
echo '<p style="color:#FF0000;">' . $status . '</p>';
} else {
?>
<div>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<h1 style="font-family: Algerian;" align="center">Update Photos</h1>
<table>
<input name="gallery_id" type="hidden" value="<?php echo $row["gallery_id"]; ?>" />
<tr>
<td class="tabledata"> <label for="photo_title">Title of photo:</label></td>
<td class="tabledata"><input id="inputbox" type="text" name="photo_title" placeholder=" Enter title" required value="<?php echo $row["photo_title"]; ?>"></td>
</tr>
<tr>
<td class="tabledata"> <img src="image/<?php echo $row["photo1"]; ?>" height="50" align="left" style="padding-right:30px;padding-left:10px"></td>
<td class="tabledata"><label for="photo1">Upload photo1 :</label></td>
<td class="tabledata"><input id="inputbox" type="file" name="photo1" id="photo1" value=$p1></td>
</tr>
<tr>
<td class="tabledata"><img src="image/<?php echo $row["photo2"]; ?>" height="50" align="left" style="padding-right:30px;padding-left:10px"></td>
<td class="tabledata"><label for="photo2">Upload photo2 :</label></td>
<td class="tabledata"><input id="inputbox" type="file" name="photo2" id="photo2" /></td>
</tr>
<tr>
<td class="tabledata"><img src="image/<?php echo $row["photo3"]; ?>" height="50" align="left" style="padding-right:30px;padding-left:10px"></td>
<td class="tabledata"><label for="photo3">Upload photo3:</label></td>
<td class="tabledata"><input id="inputbox" type="file" name="photo3" id="photo3" /></td>
</tr>
<tr>
<td class="tabledata"><img src="image/<?php echo $row["photo4"]; ?>" height="50" align="left" style="padding-right:30px;padding-left:10px"></td>
<td class="tabledata"><label for="photo4">Upload photo4:</label></td>
<td class="tabledata"><input id="inputbox" type="file" name="photo4" id="photo4" /></td>
</tr>
</table>
<br>
<p>
<input style=" margin:0px 30px; padding:10px 40px;" class="btn btn-lg btn-success" name="uploadphoto" type="submit" value="update" />
<span class="other-link"><a href="galleryadmin_view.php">View Updated Photos</a></span>
</p>
<p style="color:#228B22;"><?php echo $status; ?></p>
<br>
</form>
<?php } ?>
</div>
</div>
</body>
</html>