-
Notifications
You must be signed in to change notification settings - Fork 14
/
registrationform.php
205 lines (183 loc) · 6.53 KB
/
registrationform.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
<?php include('allhead.php'); ?>
<script>
//javascript validation for various fildss
function validateForm() {
var fname = document.forms[ "register" ][ "fname" ].value;
var lname = document.forms[ "register" ][ "lname" ].value;
var faname = document.forms[ "register" ][ "faname" ].value;
var course = document.forms[ "register" ][ "course" ].value;
var dob = document.forms[ "register" ][ "dob" ].value;
var addrs = document.forms[ "register" ][ "addrs" ].value;
var gender = document.forms[ "register" ][ "gender" ].value;
var phno = document.forms[ "register" ][ "phno" ].value;
var x = document.forms[ "register" ][ "email" ].value;
var atpos = x.indexOf( "@" );
var dotpos = x.lastIndexOf( "." );
var pass = document.forms[ "register" ][ "pass" ].value;
if ( fname == null || fname == "" ) {
alert( "First Name must be filled out" );
return false;
}
if ( lname == null || lname == "" ) {
alert( "Last Name must be filled out" );
return false;
}
if ( faname == null || faname == "" ) {
alert( "Father Name must be filled out" );
return false;
}
if ( course == null || course == "" ) {
alert( "Course must be filled out" );
return false;
}
if ( dob == null || dob == "" ) {
alert( "Date of birth must be filled out" );
return false;
}
if ( addrs == null || addrs == "" ) {
alert( "Address must be filled out" );
return false;
}
if ( gender == null || gender == "" ) {
alert( "Gender must be filled out" );
return false;
}
if ( phno == null || phno == "" ) {
alert( "Phone Number must be filled out" );
return false;
}
if ( atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length ) {
alert( "Not a valid e-mail address" );
return false;
}
if ( pass == null || pass == "" ) {
alert( "Password must be filled out" );
return false;
}
}
</script>
<div class="container" style="max-width: 1200px;">
<div class="row">
<?PHP
include( "database.php" );
if ( isset( $_POST[ 'submit' ] ) ) {
$fname = $_POST[ 'fname' ];
$lname = $_POST[ 'lname' ];
$faname = $_POST[ 'faname' ];
$course = $_POST[ 'course' ];
$dob = $_POST[ 'dob' ];
$addrs = $_POST[ 'addrs' ];
$gender = $_POST[ 'gender' ];
$phno = $_POST[ 'phno' ];
$email = $_POST[ 'email' ];
$pass = $_POST[ 'pass' ];
$done = "
<center>
<div class='alert alert-success fade in __web-inspector-hide-shortcut__'' style='margin-top:10px;'>
<a href='#' class='close' data-dismiss='alert' aria-label='close' title='close'>×</a>
<strong><h3 style='margin-top: 10px;
margin-bottom: 10px;'> Register Successfully Complete. Now You Can Login With Your Email & Password</h3>
</strong>
</div>
</center>
";
$sql = "INSERT INTO `studenttable` (`FName`, `LName`, `FaName`, `DOB`, `Addrs`, `Gender`, `PhNo`, `Eid`, `Pass`,`Course`) VALUES ('$fname','$lname','$faname','$dob','$addrs','$gender','$phno','$email','$pass','$course')";
//close the connection
mysqli_query( $connect, $sql );
echo $done;
}
?>
</div>
<div class="row">
<div class="col-md-12">
<form name="register" action="" method="POST" onsubmit="return validateForm()">
<fieldset>
<legend>
<h3 style="padding-top: 25px;"> Registration Form </h3>
</legend>
<div class="control-group form-group">
<div class="controls">
<label>First Name: <span style="color: #ff0000;">*</span></label>
<input type="text" class="form-control" name="fname" id="fname" maxlength="30">
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Last Name: <span style="color: #ff0000;">*</span></label>
<input type="text" class="form-control" name="lname" id="lname" maxlength="30">
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Father Name: <span style="color: #ff0000;">*</span></label>
<input type="text" class="form-control" name="faname" id="faname" maxlength="30">
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Course: <span style="color: #ff0000;">*</span></label>
<input type="text" class="form-control" name="course" id="course" maxlength="10">
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Date of Birth: <span style="color: #ff0000;">*</span></label>
<input type="Date" class="form-control" name="dob" id="dob">
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Address: <span style="color: #ff0000;">*</span></label>
<textarea class="form-control" name="addrs" id="addrs"></textarea>
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Gender: <span style="color: #ff0000;">*</span></label>
<p>
<label>
<input type="radio" name="gender" value="Male" id="Gender_0" checked>
Male</label>
<label>
<input type="radio" name="gender" value="Female" id="Gender_1">
Female</label>
<br>
</p>
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Contact Number (format: without code only 10 digits): <span style="color: #ff0000;">*</span></label>
<input type="tel" pattern="^\d{10}$" required class="form-control" name="phno" id="phno" maxlength="10">
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Email Id: <span style="color: #ff0000;">*</span></label>
<input type="text" class="form-control" name="email" id="email" maxlength="50">
<p class="help-block"></p>
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<label>Password: <span style="color: #ff0000;">*</span></label>
<input type="password" class="form-control" name="pass" id="pass" maxlength="30"> <span style="color: #ff0000;">*Max 30</span>
<p class="help-block"></p>
</div>
</div>
<button type="submit" name="submit" class="btn btn-primary">Register</button>
<button type="reset" name="reset" class="btn btn-danger">Clear</button>
</fieldset>
</form>
</div>
</div>
</div>
<?php include('allfoot.php'); ?>