-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodal.php
187 lines (147 loc) · 6.48 KB
/
modal.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
<!DOCTYPE html>
<html>
<head>
<?php
$result="";
if(isset($_POST['quote']) || isset($_POST['order']))
{
require 'PHPMailerAutoload.php';
require 'credential.php';
$mail = new PHPMailer;
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$visitor_phone =$_POST['phone'];
$message = $_POST['msg'];
$email_from = '$visitor_email';
$email_subject = "New Request/quote.";
$email_body = "You have received a new message from the user: $name \n contact no: $visitor_phone \n mail: $visitor_email .\n"."Here is the message:\n $message".
// $mail->SMTPDebug = 4; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = EMAIL; // SMTP username
$mail->Password = pass; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]'); // Add a recipient
$mail->addReplyTo($visitor_email);
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $email_subject;
$mail->Body = $email_body;
if(!$mail->send()) {
$result="some error has occured please reach us through mail";
} else {
$result="Thanks ".$name." we will respond you back.";
}
}
?>
<?php
include("connect.php");
$result="";
if(isset($_POST['quote']))
{
$sname=$conn->real_escape_string($_POST['name']);
$email=$conn->real_escape_string($_POST['email']);
$phone=$conn->real_escape_string($_POST['phone']);
$message=$conn->real_escape_string($_POST['msg']);
$sql="INSERT INTO requestquote (name,email,phone,message)
VALUES ('$sname','$email','$phone','$message')";
if(!$result = $conn->query($sql))
{
die('There was an error running the query [' . $conn->error . ']');
}
else{
$result="we will contact you soon.";
header("location:index.php");
}
}
?>
<?php
include("connect.php");
$result="";
if(isset($_POST['order']))
{
$sname=$conn->real_escape_string($_POST['name']);
$email=$conn->real_escape_string($_POST['email']);
$phone=$conn->real_escape_string($_POST['phone']);
$sql="INSERT INTO orders (name,email,phone)
VALUES ('$sname','$email','$phone')";
if(!$result = $conn->query($sql))
{
die('There was an error running the query [' . $conn->error . ']');
}
else{
$result="we will contact you soon.";
header("location:index.php");
}
}
?>
</head>
<body>
<div class="modal fade" id="myModal" role="dialog" style="z-index: 9999999; margin-top: 8%;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<p><?= $result ?></p>
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" style="text-align: center;">Request a Quote<br/>(Complete This form)</h4>
</div>
<div class="modal-body">
<div class="container" style="width: 80%;">
<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
<div class="form-group">
<label for="pwd">Name</label>
<input type="name" class="form-control" placeholder="Enter Name" name="name">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" placeholder="Enter Email" name="email">
</div>
<div class="form-group">
<label for="pwd">Phone</label>
<input type="phone" class="form-control" placeholder="Enter phone no." name="phone">
</div>
<div class="form-group">
<label for="pwd">Message</label>
<input type="message" class="form-control" placeholder="Message For Our Experts" name="msg">
</div>
<button type="submit" name="quote" class="btn btn-default" style="background-color: #E13737; color: white;">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="mymodal" role="dialog" style="z-index: 9999999; margin-top: 8%;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<p><?= $result ?></p>
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" style="text-align: center;">Order Inesh Services<br/>(Complete This form)</h4>
</div>
<div class="modal-body">
<div class="container" style="width: 80%;">
<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
<div class="form-group">
<label for="pwd">Name</label>
<input type="name" class="form-control" placeholder="Enter Name" name="name">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" placeholder="Enter Email" name="email">
</div>
<div class="form-group">
<label for="pwd">Phone</label>
<input type="phone" class="form-control" placeholder="Enter phone no." name="phone">
</div>
<button type="submit" name="order" class="btn btn-default" style="background-color: #E13737; color: white;">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</body></html>