-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
337 lines (245 loc) · 7.82 KB
/
signup.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtm11/DTD/xhtm1-traditional.dtd">
<html xmIns="http://www.w3.org/1999/xhtmI">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<title>Sign Up</title>
<link href="homecss.css" rel="stylesheet">
<style type="text/css">
.signuptable{
border: 1px;
background-color: grey;
padding: 10px
}
#submitbtn{
min-width: 421px
}
</style>
</head>
<body>
<?php
include_once("header.php");
?>
<form id="contact_form" class="form-horizontal" onsubmit="return validate()" method="post" action="customer_db.php">
<fieldset>
<!-- Form Name -->
<legend align="center"><h1>Sign Up</h1></legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="fname"></label>
<div class="col-md-4">
<input id="fname" name="fname" type="text" placeholder="First Name" class="form-control input-md" required="">
<span id='messageforname'></span>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="lname"></label>
<div class="col-md-4">
<input id="lname" name="lname" type="text" placeholder="Last Name" class="form-control input-md" required="">
<span id='messageforlname'></span>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="ema"></label>
<div class="col-md-4">
<input id="ema" name="ema" type="email" placeholder="Email" class="form-control input-md" required="">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="phno"></label>
<div class="col-md-4">
<input id="phno" name="phno" type="text" placeholder="Mobile No: 03111111111" class="form-control input-md" required="">
<span id='phmessage'></span>
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="addr"></label>
<div class="col-md-4">
<input id="addr" name="addr" type="text" placeholder="Address" class="form-control input-md">
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="addr"></label>
<div class="col-md-4">
<!-- <input id="addr" name="addr" type="text" placeholder="Address" class="form-control input-md"> -->
<select id="city" name="city" class="form-control input-md">
<option value="islamabad">Islamabad</option>
<option value="lahore">Lahore</option>
<option value="karachi">Karachi</option>
</select>
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="pas"></label>
<div class="col-md-4">
<input id="pas" name="pas" type="password" placeholder="Enter Password" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="repas"></label>
<div class="col-md-4">
<input id="repas" name="repas" type="password" placeholder="Retype Password" class="form-control input-md" required="">
<span id='message'></span>
</div>
</div>
<!-- Button -->
<div class="form-group" align="center" >
<label class="col-md-4 control-label" for="submitbtn"></label>
<div class="col-md-4">
<input type="submit" id="submitbtn" name="submitbtn" class="btn btn-primary" value="Register"">
</div>
</div>
</fieldset>
</form>
<script type="text/javascript">
//alert("value of fname is "+valueoffname);
$('#fname').on('keyup', function () {
var valueoffname= $('#fname').val();
//alert("value of fname is "+valueoffname);
if (valueoffname.length >= 3 || valueoffname.length == 0) {
$('#messageforname').html('').css('color', 'green');
} else {
$('#messageforname').html('Length should be greater than 2*').css('color', 'red');
}
});
$('#lname').on('keyup', function () {
var valueoflname= $('#lname').val();
//alert("value of fname is "+valueoffname);
if (valueoflname.length >= 3 || valueoflname.length == 0) {
$('#messageforlname').html('').css('color', 'green');
} else {
$('#messageforlname').html('Length should be greater than 2*').css('color', 'red');
}
});
$('#repas').on('keyup', function () {
if ($('#pas').val() == $('#repas').val()) {
$('#message').html('Passwords Matching').css('color', 'green');
} else {
$('#message').html('Passwords Not Matching').css('color', 'red');
}
});
$('#phno').on('keyup', function () {
if($.isNumeric($('#phno').val()) || $('#phno').val()==0)
{
$('#phmessage').html('').css('color', 'green');
if ($('#phno').val().length>=11 || $('#phno').val()==0)
{
$('#phmessage').html('').css('color', 'green');
}else
{
$('#phmessage').html('Length must be greater than 10').css('color', 'red');
}
} else{
$('#phmessage').html('Alphabets cant be used').css('color', 'red');
}
});
function validate(){
var pass = document.getElementById("pas").value;
var repass = document.getElementById("repas").value;
var phone = document.getElementById("phno").value;
if (checkFNameLength(true))
{
if (checkLNameLength(true))
{
if (isNumeric(phone))
{
//$('#phmessage').html('').css('color', 'red');
if (pasChk(true))
{
return true;
}
else
{
//alert("Password dosent match");
return false;
}
}else
{
//alert("Use Numbers only");
//$('#phmessage').html('Use Numbers Only').css('color', 'red');
phno.focus();
return false;
}
}else
{
lname.focus();
return false;
}
}else
{
fname.focus();
return false;
}
return false;
}
function checkFNameLength(){
var valueoffname= $('#fname').val();
//alert("value of fname is "+valueoffname);
if (valueoffname.length >= 3) {
//$('#messageforname').html('').css('color', 'green');
return true;
} else {
$('#messageforname').html('Length should be greater than 2*').css('color', 'red');
fname.focus();
return false;
}
}
function checkLNameLength(){
var valueoffname= $('#lname').val();
//alert("value of fname is "+valueoffname);
if (valueoffname.length >= 3) {
//$('#messageforname').html('').css('color', 'green');
return true;
} else {
$('#messageforlname').html('Length should be greater than 2*').css('color', 'red');
lname.focus();
return false;
}
}
function pasChk(){
var pass = document.getElementById("pas").value;
var repass = document.getElementById("repas").value;
if(repass == pass){
//alert("password are same!");
return true;
}
else{
//alert("password must be same!");
$('#message').html('Password Not Matching').css('color', 'red');
pas.focus();
return false;
}
}
function isNumeric(phone) {
if ($('#phno').val().length>=11)
{
//$('#phmessage').html('').css('color', 'green');
}else
{
$('#phmessage').html('Length must be greater than 10').css('color', 'red');
return false;
}
return !isNaN(parseFloat(phone)) && isFinite(phone);
}
</script>
<br>
<br>
<?php
include_once("footer.php");
?>
</body>
</html>