-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
214 lines (112 loc) · 3.92 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
<?php
session_start();
include("includes/db.php");
include("includes/header.php");
include("functions/functions.php");
include("includes/main.php");
?>
<!-- MAIN -->
<main>
<!-- HERO -->
<div class="nero">
<div class="nero__heading">
<span class="nero__bold">Contact</span> Us
</div>
<p class="nero__text">
If you have any questions, please feel free to contact us, our customer service center is working for you 24/7.
</p>
</div>
</main>
<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>