-
Notifications
You must be signed in to change notification settings - Fork 0
/
Add_Service.php
204 lines (173 loc) · 5.33 KB
/
Add_Service.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
<?php
require_once "database_connect.php";
if (isset($_POST['add_service'])) {
$name=$_POST['service_name'];
$filename = $_FILES["uploadfile"]["name"];
$tempname = $_FILES["uploadfile"]["tmp_name"];
$folder = "images/".$filename;
$Description=$_POST['Description'];
$service_Price=$_POST['service_Price'];
$query="INSERT INTO services(name,descr, price,image)
VALUES ('$name','$Description','$service_Price','$filename')";
$run=mysqli_query($conn,$query);
// Creation validation !!
if ($run) {
//echo "record created successfully";
}
else{
//echo "Error: " . $query . "<br>" . $conn->error;
}
}
?>
<?php
include 'header.php'
?>
<head>
<link rel ="stylesheet" href="css//Add_Service.css">
</head>
<style>
.body_add_service {
position: relative;
background-image: url("image//bg.png");
background-repeat: repeat-y;
background-color: powderblue;
background-size: 1500px 905px;
}
.solid {
border-radius: 50px;
border-color: transparent;
margin-top: 20px;
padding: 30px 60px;
margin-left: 400px;
margin-right: 360px;
background-image: url(image//borderBG.png);
height: 400px;
margin-bottom: 20px;
}
.add_new_service {
background-color: rgb(4, 73, 138);
color: white;
text-align: center;
border-radius: 100px;
padding: 10px;
font-size: 35px;
font-family: "Times New Roman", "Serif";
margin-left: 430px;
margin-right: 400px;
margin-top: 30px;
margin-bottom: -10px;
}
.sub_service {
color: white;
border-radius: 5px;
margin-top: 200px;
margin-bottom: 100px;
margin-right: 10px;
font-size: 21px;
padding: 7px;
}
.button_submit {
background-color: transparent;
margin-top: 30px;
margin-left: 40px;
text-align: center;
font-weight: bold;
color: #04498A;
border-style: solid;
border-color: rgb(4, 73, 138);
border-radius: 30px;
padding: 10px 80px;
font-family: 'Times New Roman', Times, serif;
font-size: 140%;
}
.button_submit:hover {
background-image: url(image//animals.jpg);
color: white;
}
.profile-photo {
background-color: gray;
border-radius: 150px;
overflow: hidden;
border-style: solid;
border-color: rgb(4, 73, 138);
border-width: 10px;
width: 150px;
position: relative;
top: 13px;
right: 112px;
margin-left: 750px;
margin-bottom: 30px;
margin-top: 10px;
}
.lable_add_photo {
position: absolute;
color: rgb(4, 27, 78);
top: 340px;
left: 655px;
padding: 5px 10px;
border-radius: 50px;
z-index: 3;
font-size: 15px;
cursor: pointer;
font-weight: 700;
background-color: #708090;
margin: 14px;
}
</style>
<body class="body_add_service">
<!-- ********************* End of header ********************* -->
<h1 class="add_new_service">Add A New Service: </h1>
<br>
<!-- <form action="Add_Service.php" method="post" enctype="multipart/form-data"> -->
<!--profile photo - allow user to upload photo -->
<!-- <div> <input type="file" name="uploadfile" id="file" accept="image/*" required onchange="readURL(this)">
<label for="file" class="change-lable_add_photo">Add Photo</label></div>
<div>
<img src="image//service.png" class="profile-photo" id="img" style='height:150px;'>
</div>
</form> -->
<form method="post" action="Add_Service.php" enctype="multipart/form-data">
<div> <input type="file" name="uploadfile" id="file" accept="image/*" required onchange="readURL(this)">
<label for="file" class="lable_add_photo">Add Photo</label></div>
<div>
<img src="image//service.png" class="profile-photo" id="img" style='height:150px;'>
</div>
<div class="solid">
<label ><span class="sub"> service name:
<input type="text" name="service_name"size = "35" required> </label>
<br>
<br><hr>
<label> <br> <span class="sub"> Description : </span><br>
<textarea name="Description" rows = 5 cols = 40 style="margin-left:20px; " required>
</textarea>
</label>
<br><br><hr><br>
<label><span class="sub_service"> service Price:
<input type="number" name="service_Price" min="10" max="500" required> </span></label><br>
<br>
<!-- <span ><a href="home-manager.html"> -->
<span ><a href="Home.php"><button type="button" class = "button_submit" >Back</button></a></span>
<button type="submit" class = "button_submit" onclick="warning()" name="add_service">Add</button>
<!-- </a> -->
</div>
</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]);
}
}
function warning(){
var pic_value = document.getElementById("file").value ;
if(pic_value == "")
alert("Please enter an image");
else
alert("Service added successfully!");
}
</script>
</body>
</html>