-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabout_us_manager(edit).php
222 lines (185 loc) · 5.77 KB
/
about_us_manager(edit).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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?php
include 'header.php';
include 'database_connect.php';
if (isset($_POST['submit'])) {
$filename= $_FILES["uploadfile"]["name"];
$tempname=$_FILES["uploadfile"]["tmp_name"];
$folder = "images/".$filename;
$abou = $_POST["aboutus"];
$location = $_POST["location"];
if($filename!=null){
$query="
UPDATE about SET about_us='$abou',location='$location',image='$filename' WHERE id=1";
}
else{
$query="
UPDATE about SET about_us='$abou',location='$location' WHERE id=1";
}
$run=mysqli_query($conn, $query);
if ($run) {
echo '<script>alert("Changes successfully saved");
</script>';
// header('location :about_us_maneger(view).php');
header('Location:about_us_maneger(view).php');
}
else {
echo '<script>alert("Changes has not saved ")</script>';
}
if (move_uploaded_file($tempname, $folder)) {
// echo "Image uploaded successfully";
}else{
// echo "Failed to upload image";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title> Happy Paws Clinic </title>
<meta name = "description" content="Happy Paws Clinic"/>
<link rel ="stylesheet" href="css//style.css">
</head>
<style>
.about_body {
width:100% !important ;
min-height:70vw !important;
background: #B0E0E6 !important;
}
.about_edit_button{
margin: 39px 415px -4px 200px !important;
text-align: center !important;
font-weight: bold !important;
color: #04498A !important;
border-style: solid !important;
border-color: #708090 !important;
border-radius: 30px !important;
padding: 10px !important;
font-family: 'Times New Roman', Times, serif;
font-size: 100%;
position: relative;
top: 164%;
right: 200px;
cursor: pointer;
width: 150px;
}
.about_edit_button:hover{
background-image: url(image/animals.jpg);
color:white;
}
.choose_file{ margin: -6px 499px 4px 206px;
margin: -6px 228px 4px 206px;
text-align: center;
font-weight: bold;
color: #04498A;
border-style: solid;
border-color: #708090;
border-radius: 30px;
padding: 10px;
font-family: 'Times New Roman', Times, serif;
font-size: 48%;
position: relative;
top: 170%;
right: 0px;
cursor: pointer;}
.choose_file:hover{
background-image: url(image/animals.jpg);
color:white;}
.about_edit_button:hover{
background-image: url(image/animals.jpg);
color:white !important;}
.about_back_button{
margin: 15px 414px 9px 205px;
text-align: center;
font-weight: bold;
color: #04498A;
border-style: solid;
border-color: #708090;
border-radius: 30px;
padding: 10px;
font-family: 'Times New Roman', Times, serif;
font-size: 44%;
position: relative;
top: -9%;
right: 202px;
cursor: pointer;
width: 149px;
}
.about_back_button:hover{
background-image: url(image/animals.jpg);
color: white;}
.about_us_edit_header{
font-family:"Times New Roman", Times, serif;
color:rgb(4,73,138);
font-size:15px;
}
.box_fieldset{
width: 1000px;
background-image:url(about1.png);
/* height:600px; */
background-size:cover;
background-color:white;
margin:auto;
margin-top: 100px;
border-radius:3%;
font-family:'Times New Roman', Times, serif;
}
.box_fieldset h1{
font-family:"Times New Roman", Times, serif;
color:rgb(4,73,138);
text-align:center;
font-size: 45px;
}
.box_fieldset p{
font-family:"Times New Roman", Times, serif;
color:GrayText;
text-align:center;
font-size: 18px;
}.image_about{
height: 300px;
margin: 24px;}
</style>
<body class="about_body" style=" overflow-x: hidden;">
<fieldset class ="box_fieldset" style="overflow:auto">
<div>
<?php
$query="select * from about where id=1 ";
$run=mysqli_query($conn,$query);
while ($row=mysqli_fetch_array($run)) {
$about= $row['about_us'];
$image=$row['image'];
$location=$row['location'];
}
?>
<form method ="Post" action ="#" enctype="multipart/form-data">
<p ><label><h1 class="about_us_edit_header">About Us<h1><br>
<textarea class ="about_us_textarea" name ="aboutus" value="" rows="15" cols="75"> <?php echo $about;?>
</textarea></label></p>
<p ><label><h1 class="about_us_ourlocation">Our Location<h1>
<br>
<textarea class ="about_us_textarea" name ="location" value=""
rows="5" cols="70"><?php echo $location;?></textarea></label></p>
<img src="images/<?php echo $image;?>" alt="Treatment" id="img" class="image_about" style="width:50% width: 50%;height: 300px;">
<div class="">
</div>
<?php
// ?>
<label for="file" class="choose_file" >Change Photo</label>
<input type="file" class="" accept="image/*" id="file" name="uploadfile" accept="image/*" onchange="readURL(this)" style="display:none;">
<p ><input class="about_edit_button" type="submit" name ="submit" value="Update"></p>
<a href="about_us_maneger(view).php"> <button class="about_back_button" type="button"> Back</button></a>
</form>
<script>
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
document.querySelector("#img").setAttribute("src",e.target.result);
};
reader.readAsDataURL(input.files[0]);
}
}
</script>
</fieldset>
</body>
</html>