-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaceOrder.php
268 lines (208 loc) · 8.91 KB
/
placeOrder.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Place Order</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="styler.css">
<meta name="theme-color" content="#0073e6">
<link rel="stylesheet" type="text/css" href="animate.css">
<script src="wow.min.js"></script>
<script>
new WOW().init();
</script>
</head>
<style type="text/css">
body{padding-top: 40px}
.error{color:red;}
</style>
<body data-spy="scroll" data-target="#my-navbar2">
<!--Navbar starts-->
<nav class="navbar navbar-inverse navbar-fixed-top" id="my-navbar2">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle wow bounceInDown" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">MTC</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li ><a href="index.php#feedback">Feedback</a></li>
<li ><a href="index.php#price-list">Price Details</a></li>
<li ><a href="index.php#faq">Faq</a></li>
<li ><a href="index.php#about">About Us</a></li>
<li ><a href="index.php#contact">Contact Us</a></li>
</ul>
</div>
</div>
</nav>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!--Navbar ends-->
<div class="jumbotron text-center" style="background-color:#0073e6">
<h1 >MEHTA TRADING COMPANY </h1><span><img src="truck.png" style="height:30px ;width:30px" /></span><h6><strong>Automobile Spare Parts Distribution</strong></h6></span>
<p>We offer the best products at the lowest rates</p>
<div class="btn-group btn-lg" role="group" aria-label="">
<a href="index.php#price-list"><button type="button" class="btn btn-info" style="padding-left:20px; padding-right:20px;background-color:#66b3ff">View Products</button></a>
<a href="products.php"><button type="button" class="btn btn-success btn-success-outline" style="padding-left:20px; padding-right:20px;background-color:#70db70">Exquisite Products</button></a>
</div>
</div>
<div class="container">
<section>
<div class="page-header">
<h2>Place Order Form <span class="glyphicon glyphicon-envelope"></span></h2>
</div><!-- End Page Header -->
<div class="row">
<div class="col-md-12">
<?php
// define variables and set to empty values
$nameerror = $emailerror = $messageerror= $messagetotal= $mobileerror = $header = "";
$name = $email = $message= $website= $mobile = $mymessage = $mymail = "";
if(isset($_POST['name1'],$_POST['email1'],$_POST['message1'],$_POST['mobile1'])){
if(empty($_POST['name1']))
{
$nameerror="Please enter a name";
}else{
$name=htmlentities($_POST['name1']);
}
if(empty($_POST['email1']))
{
$emailerror="Please enter an email address";
}
else if (strlen($_POST['email1'])>25) {
$emailerror="Your email address is too long. Please enter a correct email address.";
}
else if(filter_var($_POST['email1'],FILTER_VALIDATE_EMAIL)==false)
{
$emailerror="Please provide a valid email address";
}
else{
$email="<".htmlentities($_POST['email1']).">";
}
if(empty($_POST['message1']))
{
$messageerror="Please enter a message";
}else{
$message=htmlentities($_POST['message1']);
}
if(empty($_POST['mobile1']))
{
$mobileerror="Please enter a Mobile no.";
}
else if (!preg_match("/^[0-9]*$/",$_POST['mobile1'])) {
$mobileerror = "Please enter only digits";
}
else if (strlen($_POST['mobile1'])>15)
{
$mobileerror="Please enter a valid Mobile no.";
}
else if(strlen($_POST['mobile1'])<10)
{
$mobileerror="Please enter a valid Mobile No.";
}
else{
$mobile=htmlentities($_POST['mobile1']);
}
$messagetotal="Name: $name"."\n"."E-mail Address: $email"."\n"."Mobile No. : $mobile"."\n"."Message: $message";
$mymail="rajenmehta5@gmail.com";
$mymessage="Thank you for your message. We have successfully stored your data and we will revert back to you soon.";
$headers="From: $email";
$header="From: $mymail";
if(empty($nameerror) && empty($emailerror) && empty($messageerror) && empty($mobileerror))
{
mail($mymail, 'Website based message entry', $messagetotal, $headers);
mail($email, 'Mehta Trading Company', $mymessage, $header);
}
}
?>
<form name="form1" method="POST" action="" class="form-horizontal" id="register-form">
<div class="form-group">
<label for="user-name" class="col-md-2 control-label">Name<label style="color:red">*</label></label>
<div class="col-md-10">
<input type="text" class="form-control" name="name1" id="user-name" placeholder="Enter you name">
<span class="error" style="color:red"><?php echo $nameerror;?></span>
</div>
</div><!-- End form group -->
<div class="form-group">
<label for="user-email" class="col-md-2 control-label">E-mail<label style="color:red">*</label></label>
<div class="col-md-10">
<input type="text" class="form-control" name="email1" id="user-email" placeholder="Enter you Email Address">
<span class="error" style="color:red"><?php echo $emailerror;?></span>
</div>
</div><!-- End form group -->
<div class="form-group">
<label for="mobile" class="col-md-2 control-label">Mobile No.<label style="color:red">*</label></label>
<div class="col-md-10">
<input type="text" class="form-control" name="mobile1" id="mobile" placeholder="Enter you Mobile No.">
<span class="error" style="color:red"><?php echo $mobileerror;?></span>
</div>
</div><!-- End form group -->
<div class="form-group">
<label for="user-url" class="col-md-2 control-label">Your Website</label>
<div class="col-md-10">
<input type="text" name="website1" class="form-control" id="website1" placeholder="If you have Any.">
</div>
</div><!-- End form group -->
<div class="form-group">
<label for="user-message" class="col-md-2 control-label">Any Message<label style="color:red">*</label></label>
<div class="col-md-10">
<textarea name="message1" id="message1" class="form-control"
cols="20" rows="10" placeholder="Enter your Message"></textarea>
<span class="error" style="color:red"><?php echo $messageerror;?></span>
</div>
</div><!-- End form group -->
<div class="form-group">
<div class="col-md-4 col-md-offset-2">
<input type="submit" name="submit" value="Submit" class="btn btn-primary"></button>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
<!--CONTACT US ENDS-->
<hr>
<footer>
<div class="container-fluid" style="background-color:#808080">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4 text-center">
<h5 style="color:white">Copyright © <?php echo date("Y"); ?> Mehta Trading Company | All rights reserved</h5>
</div>
<div class="col-md-2">
</div>
<div class="col-md-2 col-md-offset-2 text-center">
<h6 style="padding-left:55px ;padding-top:-20px">By: Tirth Rajen Mehta</h6>
</div>
</div>
</div>
</footer>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var validator = $("#register-form").bootstrapValidator({
fields:{
name1:{
message:"Name is required",
validators:{
notEmpty:{
message:"Please provide a name"
}
}
}
}
});
});
</script>
</body>
</html>