-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsignup.php
206 lines (194 loc) · 6.16 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
<html>
<head>
<title>SignUp Page || Online Quiz Test</title>
<script src="jquery-1.12.3.min.js"></script>
<script src="jquery-validate1.9.0.min.js"></script>
<script src="uid_verify.js"></script>
<style>
.warning{
font-size: 10px;
color: red;
}
</style>
</head>
<body>
<center>
<h1>Sign Up Page</h1>
<hr>
<form id="regrcv" name="regrcv" action="adduser.php" method="POST">
<table>
<tr>
<th>Full Name: </th>
<td><input type="text" id="fname" name="fname"></td>
<!--<td><label id="fname"></label></td>-->
</tr>
<tr>
<th>User ID: </th>
<td><input type="text" id="uid" name="uid" ></td>
<td id="availability"></td>
<!--onBlur="checkusername()" <td><label id="uid"></label></td>-->
</tr>
<tr>
<th>Email: </th>
<td><input type="text" id="email" name="email"></td>
<!--<td><label id="email"></label></td>-->
</tr>
<tr>
<th>Gender: </th>
<td><select id="gender" name="gender">
<option value="select">Select Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</td>
</tr>
<tr>
<th>DOB: </th>
<td><input type="date" id="dob" name="dob"></td>
<!--<td><label id="dob"></label></td>-->
</tr>
<tr>
<th>Role: </th>
<td><select id="role" name="role">
<option value="select">Select Role</option>
<option value="Teacher">Teacher</option>
<option value="Student">Student</option>
</select>
</td>
</tr>
<tr>
<th>Education Level: </th>
<td><select id="edu" name="edu">
<option value="select">Select Edu</option>
<option value="Phd">Phd</option>
<option value="Master's">Master's</option>
<option value="Graduate">Graduate</option>
<option value="Under Graduate">Under Graduate</option>
<option value="College">College</option>
<option value="School">School</option>
</select>
</td>
</tr>
<tr>
<th>Phone: </th>
<td><input type="text" id="phone" name="phone"></td>
<!--<td><label id="phone"></label></td>-->
</tr>
<tr>
<th>Address: </th>
<td><textarea id="address" name="address" cols="22" rows="4"></textarea></td>
<!--<td><label id="address"></label></td>-->
</tr>
<tr>
<th>Password: </th>
<td><input type="password" id="pass" name="pass"></td>
<!--<td><label id="pass"></label></td>-->
</tr>
<tr>
<th> </th>
<td><input type="submit" name="submit" value="Sign Up"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
<script>
/*function checkusername(){
var status = document.getElementById("usernamestatus");
var u = document.getElementById("uid").value;
if(u != ""){
status.innerHTML = 'checking...';
var hr = new XMLHttpRequest();
hr.open("POST", "uid_verify.php", true);
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hr.onreadystatechange = function() {
if(hr.readyState == 4 && hr.status == 200) {
status.innerHTML = hr.responseText;
}
}
var v = "name2check="+u;
hr.send(v);
}
}*/
$(document).ready(function(){
//alert("aas kk ahi ");
$("#regrcv").validate({
rules: {
fname: "required",
uid: "required",
check_uid: "required",
email: {
required: true,
email: true
},
gender: {
selectcheck: true
},
dob: "required",
role: {
selectcheck: true
},
edu: {
selectcheck: true
},
phone: {
required: true,
minlength: 11
},
address: "required",
pass: {
required: true,
minlength: 6
}
},
messages: {
fname: "<br/><p class='warning'>Please enter your full name</p>",
uid: "<br/><p class='warning'>Please enter your username</p>",
email: {
required: "<br/><p class='warning'>Please provide a your email</p>",
email: "<br/><p class='warning'>Please enter a valid email address</p>"
},
gender: {
selectcheck: "<br/><p class='warning'>Please select a gender</p>"
},
dob: "<br/><p class='warning'>Please enter your date of birth</p>",
role: {
selectcheck: "<br/><p class='warning'>Please select your role</p>"
},
edu: {
selectcheck: "<br/><p class='warning'>Please select your education level</p>"
},
phone: {
required: "<br/><p class='warning'>Please provide a phone number</p>",
minlength: "<br/><p class='warning'>Your password must be 11 characters long</p>"
},
address: "<br/><p class='warning'>Please enter your address</p>",
pass: {
required: "<br/><p class='warning'>Please provide a password</p>",
minlength: "<br/><p class='warning'>Your password must be at least 6 characters long</p>"
}
},
submitHandler: function(form) {
form.submit();
}
});
jQuery.validator.addMethod('selectcheck', function (value) {
return (value != 'select');
});
$('#uid').blur(function(){
var uid = $('#uid').val();
$.ajax({
url:"uid_verify.php",
type:"POST",
data:{uid:uid},
dataType:"html",
success:function(data)
{
$('#availability').html(data);
//window.location.assign("http://localhost/Work/online_quiz/signup.php");
}
});
});
});
</script>