-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Supplier_Registration.php
363 lines (322 loc) · 11.6 KB
/
A_Supplier_Registration.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
<?php require_once('connection.php');
/**
* @author Yasiru
* contact me : https://linktr.ee/yasiruchamuditha for more information.
*/
session_start();
if(isset($_POST["btnSubmit"]))
{
if (isset($_SESSION["Email"]))
{
$Registration_No=$_POST["txtRegNo"];
$Company_Name=$_POST["txtCompanyName"];
$Address=$_POST["txtAddress"];
$Telephone_No=$_POST["txtTelephoneNo"];
$Fax_No=$_POST["txtFaxNo"];
$Email=$_POST["txtEmail"];
$Director_Name=$_POST["txtDirectorName"];
$Mobile_No=$_POST["txtMobileNo"];
//perform sql
$sql = "INSERT INTO supplier_registration (Registration_No,Company_Name,Address,Telephone_No,Fax_No,Email,Director_Name,Mobile_No) VALUES ('$Registration_No','$Company_Name','$Address','$Telephone_No','$Fax_No','$Email','$Director_Name','$Mobile_No')";
$ret= mysqli_query($con, $sql);
//echo '<script>alert("Successfuly Registered")</script>';
header('location:A_Supplier_Registration.php');
//disconnect
mysqli_close($con);
}
else
{
header("location:M_User_Login.php");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Admin Panel - Supplier Registration</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Fuel Up" name="keywords">
<meta content="Fuel Status" name="description">
<!-- Favicon -->
<link href="img/favicon.ico" rel="icon">
<!-- Google Web Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Rubik&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
<!-- Libraries Stylesheet -->
<link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="lib/tempusdominus/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" />
<!-- Customized Bootstrap Stylesheet -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- css Stylesheet -->
<link href="css/style.css" rel="stylesheet">
<link href="css/style_Panel1.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/c4254e24a8.js" crossorigin="anonymous"></script>
</head>
<body style="background: url(img/supplier.jpg);">
<?php require('A_Navigation_Bar.php');?>
<!--Form START-->
<div class="container-fluid">
<div class="container mt-3" >
<h1>Admin Panel - Supplier Registration</h1>
<!--form -->
<form class="row g-3 needs-validation" action="#" method="post" onsubmit="return result()">
<!--Reg No-->
<div class="inputfeild mt-2">
<label for="Registration No" class="form-label">Registration No</label>
<input type="text" class="form-control" id="txtRegNo" name="txtRegNo" placeholder="Registration No" onkeyup="validateRegistrationNo()">
<span id="Registration_Error"></span>
</div>
<!--Name-->
<div class="inputfeild mt-2">
<label for="Name" class="form-label">Name</label>
<input type="text" class="form-control" id="txtCompanyName" name="txtCompanyName" placeholder="Company Name" onkeyup="CompanyNamevalidate()">
<span id="Name_Error"></span>
</div>
<!--Address-->
<div class="inputfeild mt-2">
<label for="Address" class="form-label">Address</label>
<label for="Address" class="form-label">No</label>
<input type="text" class="form-control" id="txtAddress" name="txtAddress" placeholder="Ex:No" onkeyup="validateaddress()" >
<span id="Address_Error"></span>
</div>
<!--Contact No -->
<div class="inputfeild mt-2">
<div class="row">
<div class="col">
<label for="TelephoneNo" class="form-label">Telephone No</label>
<input type="tel" class="form-control" id="txtTelephoneNo" name="txtTelephoneNo" placeholder="Ex:0123456789" onkeyup="validateTelephoneNo()">
<span id="TelephoneNo_Error"></span>
</div>
<div class="col">
<label for="FaxNo" class="form-label">Fax No</label>
<input type="tel" class="form-control" id="txtFaxNo" name="txtFaxNo" placeholder="Ex:0123456789" onkeyup="validateFaxNo()">
<span id="FaxNo_Error"></span>
</div>
</div>
</div>
<!--Email-->
<div class="inputfeild mt-2">
<label for="Email" class="form-label">Email</label>
<input type="email" class="form-control" id="txtEmail" name="txtEmail" placeholder="Ex:[email protected]" onkeyup="validateEmail()">
<span id="Email_Error"></span>
</div>
<!--Owner Details-->
<h3>Owner Details</h3>
<!--Owner Name-->
<div class="inputfeild mt-2">
<label for="OwnerName" class="form-label">Name</label>
<input type="text" class="form-control" id="txtDirectorName" name="txtDirectorName" placeholder="Name" onkeyup="DirectorNamevalidate()" >
<span id="Director_Error"></span>
</div>
<!--Mobile No-->
<div class="inputfeild mt-2">
<label for="MobileNo" class="form-label">Mobile No</label>
<input type="tel" class="form-control" id="txtMobileNo" name="txtMobileNo" placeholder="Ex:0123456789" onkeyup="validateMobileNo()">
<span id="MobileNo_Error"></span>
</div>
<!--Check Terms -->
<div class="inputfeild mt-2 form-check">
<input type="checkbox" id="chkCheck" class="form-check-input" name="chkCheck" onkeyup="validateTerms()" >
<label class="form-check-label" for="exampleCheck1">Agree to Terms and Conditions</label><br> <span id="checkbox_Error"></span>
</div>
<!--Button-->
<button type="submit" class="btn btn-outline-primary btn-lg" name="btnSubmit" id="btnSubmit">Submit</button>
</form>
</div>
</div>
<?php require('A_Footer.php');?>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="lib/easing/easing.min.js"></script>
<script src="lib/waypoints/waypoints.min.js"></script>
<script src="lib/owlcarousel/owl.carousel.min.js"></script>
<script src="lib/tempusdominus/js/moment.min.js"></script>
<script src="lib/tempusdominus/js/moment-timezone.min.js"></script>
<script src="lib/tempusdominus/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Javascript -->
<script src="js/main.js"></script>
<script type="text/javascript">
var Registration_Error=document.getElementById('Registration_Error');
var Name_Error=document.getElementById('Name_Error');
var Address_Error=document.getElementById('Address_Error');
var TelephoneNo_Error=document.getElementById('TelephoneNo_Error');
var FaxNo_Error=document.getElementById('FaxNo_Error');
var Email_Error=document.getElementById('Email_Error');
var Director_Error=document.getElementById('Director_Error');
var MobileNo_Error=document.getElementById('MobileNo_Error');
var checkbox_Error=document.getElementById('checkbox_Error');
function validateRegistrationNo()
{
var Registration_no=document.getElementById('txtRegNo').value.replace(/^\s+|\s+$/g, "");
if(Registration_no.length == 0)
{
Registration_Error.innerHTML='Registration number is required.';
return false;
}
else
{
var re = /^[A-Z-0-9]{10}$/;
//var re = /^[a-zA-Z0-9_]+$/;
if(!Registration_no.match(re))
{
Registration_Error.innerHTML='Please Enter Registration number in correct format and correct length.';
return false;
}
}
Registration_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
function CompanyNamevalidate()
{
var Name=document.getElementById('txtCompanyName').value.replace(/^\s+|\s+$/g, "");
if(Name.length == 0)
{
Name_Error.innerHTML='Name is required.';
return false;
}
Name_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
function validateaddress()
{
var ADDRESS=document.getElementById('txtAddress').value.replace(/^\s+|\s+$/g, "");
if(ADDRESS.length == 0)
{
Address_Error.innerHTML='Address No is required.';
return false;
}
Address_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
function validateTelephoneNo()
{
var TelephoneNo = document.getElementById('txtTelephoneNo').value.replace(/^\s+|\s+$/g, "");
if (TelephoneNo.length == 0)
{
TelephoneNo_Error.innerHTML='Mobile Number is required.';
return false;
}
else
{
var mobilePattern = /^[0-9]{10}$/;
if (!TelephoneNo.match(mobilePattern))
{
TelephoneNo_Error.innerHTML='Please Enter Mobile Number in correct format.';
return false;
}
TelephoneNo_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
}
function validateFaxNo()
{
var FaxNo = document.getElementById('txtFaxNo').value.replace(/^\s+|\s+$/g, "");
if (FaxNo.length == 0)
{
FaxNo_Error.innerHTML='Fax Number is required.';
return false;
}
else
{
var mobilePattern = /^[0-9]{10}$/;
if (!FaxNo.match(mobilePattern))
{
FaxNo_Error.innerHTML='Please Enter Fax Number in correct format.';
return false;
}
FaxNo_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
}
function validateEmail()
{
var Email = document.getElementById('txtEmail').value.replace(/^\s+|\s+$/g, "");
if (Email.length == 0)
{
Email_Error.innerHTML='Email is required.';
return false;
}
else
{
var emaiPattern = /^[^ ]+@[^ ]+\.[a-z]{2,3}$/;
if (!Email.match(emaiPattern))
{
Email_Error.innerHTML='Please Enter Email in correct format.';
return false;
}
Email_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
}
function DirectorNamevalidate()
{
var Name=document.getElementById('txtDirectorName').value.replace(/^\s+|\s+$/g, "");
if(Name.length == 0)
{
Director_Error.innerHTML='Name is required.';
return false;
}
Director_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
function validateMobileNo()
{
var MobileNo = document.getElementById('txtMobileNo').value.replace(/^\s+|\s+$/g, "");
if (MobileNo.length == 0)
{
MobileNo_Error.innerHTML='Mobile Number is required.';
return false;
}
else
{
var mobilePattern = /^[0-9]{10}$/;
if (!MobileNo.match(mobilePattern))
{
MobileNo_Error.innerHTML='Please Enter Mobile Number in correct format.';
return false;
}
MobileNo_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
}
function validateTerms()
{
if(document.getElementById("chkCheck").checked == false)
{
checkbox_Error.innerHTML='Please Agree To Terms and Conditions.';
return false;
}
checkbox_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
document.getElementById("chkCheck").addEventListener("click", function() {
if(document.getElementById('chkCheck').checked == true){
checkbox_Error.innerHTML = '<i class="fa-regular fa-circle-check"></i>';
return true;
}
});
function result()
{
validateRegistrationNo();
CompanyNamevalidate();
validateaddress();
validateTelephoneNo();
validateFaxNo();
validateEmail();
DirectorNamevalidate();
validateMobileNo();
validateTerms();
if(!validateRegistrationNo() || (!CompanyNamevalidate()) || (!validateaddress()) ||(!validateTelephoneNo()) ||(!validateFaxNo()) ||(!validateEmail()) || (!DirectorNamevalidate()) || (!validateMobileNo()) || (!validateTerms()) )
{
return false;
}
}
</script>
</body>
</html>