-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontact.php
462 lines (243 loc) · 8.72 KB
/
contact.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<?php
session_start();
include("includes/db.php");
include("functions/functions.php");
?>
<!DOCTYPE html>
<html>
<head>
<title>E commerce Store </title>
<link href="http://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100" rel="stylesheet" >
<link href="styles/bootstrap.min.css" rel="stylesheet">
<link href="styles/style.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
<div id="top"><!-- top Starts -->
<div class="container"><!-- container Starts -->
<div class="col-md-6 offer"><!-- col-md-6 offer Starts -->
<a href="#" class="btn btn-success btn-sm" >
<?php
if(!isset($_SESSION['customer_email'])){
echo "Welcome :Guest";
}else{
echo "Welcome : " . $_SESSION['customer_email'] . "";
}
?>
</a>
<a href="#">
Shopping Cart Total Price: <?php total_price(); ?>, Total Items <?php items(); ?>
</a>
</div><!-- col-md-6 offer Ends -->
<div class="col-md-6"><!-- col-md-6 Starts -->
<ul class="menu"><!-- menu Starts -->
<li>
<a href="customer_register.php">
Register
</a>
</li>
<li>
<?php
if(!isset($_SESSION['customer_email'])){
echo "<a href='checkout.php' >My Account</a>";
}
else{
echo "<a href='customer/my_account.php?my_orders'>My Account</a>";
}
?>
</li>
<li>
<a href="cart.php">
Go to Cart
</a>
</li>
<li>
<?php
if(!isset($_SESSION['customer_email'])){
echo "<a href='checkout.php'> Login </a>";
}else {
echo "<a href='logout.php'> Logout </a>";
}
?>
</li>
</ul><!-- menu Ends -->
</div><!-- col-md-6 Ends -->
</div><!-- container Ends -->
</div><!-- top Ends -->
<div class="navbar navbar-default" id="navbar"><!-- navbar navbar-default Starts -->
<div class="container" ><!-- container Starts -->
<div class="navbar-header"><!-- navbar-header Starts -->
<a class="navbar-brand home" href="index.php" ><!--- navbar navbar-brand home Starts -->
<img src="images/logo.png" alt="computerfever logo" class="hidden-xs" >
<img src="images/logo-small.png" alt="computerfever logo" class="visible-xs" >
</a><!--- navbar navbar-brand home Ends -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation" >
<span class="sr-only" >Toggle Navigation </span>
<i class="fa fa-align-justify"></i>
</button>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#search" >
<span class="sr-only" >Toggle Search</span>
<i class="fa fa-search" ></i>
</button>
</div><!-- navbar-header Ends -->
<div class="navbar-collapse collapse" id="navigation" ><!-- navbar-collapse collapse Starts -->
<div class="padding-nav" ><!-- padding-nav Starts -->
<ul class="nav navbar-nav navbar-left"><!-- nav navbar-nav navbar-left Starts -->
<li>
<a href="index.php"> Home </a>
</li>
<li>
<a href="shop.php"> Shop </a>
</li>
<li>
<?php
if(!isset($_SESSION['customer_email'])){
echo "<a href='checkout.php' >My Account</a>";
}
else{
echo "<a href='customer/my_account.php?my_orders'>My Account</a>";
}
?>
</li>
<li>
<a href="cart.php"> Shopping Cart </a>
</li>
<li>
<a href="about.php"> About Us </a>
</li>
<li>
<a href="services.php"> Services </a>
</li>
<li class="active" >
<a href="contact.php"> Contact Us </a>
</li>
</ul><!-- nav navbar-nav navbar-left Ends -->
</div><!-- padding-nav Ends -->
<a class="btn btn-primary navbar-btn right" href="cart.php"><!-- btn btn-primary navbar-btn right Starts -->
<i class="fa fa-shopping-cart"></i>
<span> <?php items(); ?> items in cart </span>
</a><!-- btn btn-primary navbar-btn right Ends -->
<div class="navbar-collapse collapse right"><!-- navbar-collapse collapse right Starts -->
<button class="btn navbar-btn btn-primary" type="button" data-toggle="collapse" data-target="#search">
<span class="sr-only">Toggle Search</span>
<i class="fa fa-search"></i>
</button>
</div><!-- navbar-collapse collapse right Ends -->
<div class="collapse clearfix" id="search"><!-- collapse clearfix Starts -->
<form class="navbar-form" method="get" action="results.php"><!-- navbar-form Starts -->
<div class="input-group"><!-- input-group Starts -->
<input class="form-control" type="text" placeholder="Search" name="user_query" required>
<span class="input-group-btn"><!-- input-group-btn Starts -->
<button type="submit" value="Search" name="search" class="btn btn-primary">
<i class="fa fa-search"></i>
</button>
</span><!-- input-group-btn Ends -->
</div><!-- input-group Ends -->
</form><!-- navbar-form Ends -->
</div><!-- collapse clearfix Ends -->
</div><!-- navbar-collapse collapse Ends -->
</div><!-- container Ends -->
</div><!-- navbar navbar-default Ends -->
<div id="content" ><!-- content Starts -->
<div class="container" ><!-- container Starts -->
<div class="col-md-12" ><!--- col-md-12 Starts -->
<ul class="breadcrumb" ><!-- breadcrumb Starts -->
<li>
<a href="index.php">Home</a>
</li>
<li>Contact Us</li>
</ul><!-- breadcrumb Ends -->
</div><!--- col-md-12 Ends -->
<div class="col-md-12" ><!-- col-md-12 Starts -->
<div class="box" ><!-- box Starts -->
<div class="box-header" ><!-- box-header Starts -->
<center><!-- center Starts -->
<?php
$get_contact_us = "select * from contact_us";
$run_conatct_us = mysqli_query($con,$get_contact_us);
$row_conatct_us = mysqli_fetch_array($run_conatct_us);
$contact_heading = $row_conatct_us['contact_heading'];
$contact_desc = $row_conatct_us['contact_desc'];
$contact_email = $row_conatct_us['contact_email'];
?>
<h2> <?php echo $contact_heading; ?> </h2>
<p class="text-muted" >
<?php echo $contact_desc; ?>
</p>
</center><!-- center Ends -->
</div><!-- box-header Ends -->
<form action="contact.php" method="post" ><!-- form Starts -->
<div class="form-group" ><!-- form-group Starts -->
<label>Name</label>
<input type="text" class="form-control" name="name" required>
</div><!-- form-group Ends -->
<div class="form-group"><!-- form-group Starts -->
<label>Email</label>
<input type="text" class="form-control" name="email" required>
</div><!-- form-group Ends -->
<div class="form-group"><!-- form-group Starts -->
<label> Subject </label>
<input type="text" class="form-control" name="subject" required>
</div><!-- form-group Ends -->
<div class="form-group"><!-- form-group Starts -->
<label> Message </label>
<textarea class="form-control" name="message"> </textarea>
</div><!-- form-group Ends -->
<div class="form-group"><!-- form-group Starts -->
<label> Select Enquiry Type </label>
<select name="enquiry_type" class="form-control"><!-- select Starts -->
<option> Select Enquiry Type </option>
<?php
$get_enquiry_types = "select * from enquiry_types";
$run_enquiry_types = mysqli_query($con,$get_enquiry_types);
while($row_enquiry_types = mysqli_fetch_array($run_enquiry_types)){
$enquiry_title = $row_enquiry_types['enquiry_title'];
echo "<option> $enquiry_title </option>";
}
?>
</select><!-- select Ends -->
</div><!-- form-group Ends -->
<div class="text-center"><!-- text-center Starts -->
<button type="submit" name="submit" class="btn btn-primary">
<i class="fa fa-user-md"></i> Send Message
</button>
</div><!-- text-center Ends -->
</form><!-- form Ends -->
<?php
if(isset($_POST['submit'])){
// Admin receives email through this code
$sender_name = $_POST['name'];
$sender_email = $_POST['email'];
$sender_subject = $_POST['subject'];
$sender_message = $_POST['message'];
$enquiry_type = $_POST['enquiry_type'];
$new_message = "
<h1> This Message Has Been Sent By $sender_name </h1>
<p> <b> Sender Email : </b> <br> $sender_email </p>
<p> <b> Sender Subject : </b> <br> $sender_subject </p>
<p> <b> Sender Enquiry Type : </b> <br> $enquiry_type </p>
<p> <b> Sender Message : </b> <br> $sender_message </p>
";
$headers = "From: $sender_email \r\n";
$headers .= "Content-type: text/html\r\n";
mail($contact_email,$sender_subject,$new_message,$headers);
// Send email to sender through this code
$email = $_POST['email'];
$subject = "Welcome to my website";
$msg = "I shall get you soon, thanks for sending us email";
$from = "[email protected]";
mail($email,$subject,$msg,$from);
echo "<h2 align='center'>Your message has been sent successfully</h2>";
}
?>
</div><!-- box Ends -->
</div><!-- col-md-12 Ends -->
</div><!-- container Ends -->
</div><!-- content Ends -->
<?php
include("includes/footer.php");
?>
<script src="js/jquery.min.js"> </script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>