-
Notifications
You must be signed in to change notification settings - Fork 23
/
add_student.php
189 lines (166 loc) · 8.1 KB
/
add_student.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
<?php
include './Database/Controler.php';
include 'role.php';
?>
<!-- /. ROW -->
<script language="javascript" src="./assets/js/validation.js"></script>
<script language="javascript">
function num_check(event)
{
code=event.keyCode
if(!((code>=48 && code<=57)))
{
alert("Please Enter Only Numbers");
event.keyCode=0;
}
}
function validate_form(f1)
{
if(isEmpty(f1.firstname.value,"the First Name.."))
{
alert(errMsg);
f1.firstname.focus();
return (false);
}
if(isEmpty(f1.lastname.value,"the Last Name.."))
{
alert(errMsg);
f1.lastname.focus();
return (false);
}
if(isEmpty(f1.s_rn.value,"the Roll Number.."))
{
alert(errMsg);
f1.s_rn.focus();
return (false);
}
if(isEmpty(f1.semr.value,"the Semester.."))
{
alert(errMsg);
f1.semr.focus();
return (false);
}
if(isEmpty(f1.email.value,"the Email Id.."))
{
alert(errMsg);
f1.email.focus();
return (false);
}
if(isEmpty(f1.contact.value,"the Contact Number.."))
{
alert(errMsg);
f1.contact.focus();
return (false);
}
if(isEmpty(f1.c_idr.value,"the Stream.."))
{
alert(errMsg);
f1.c_idr.focus();
return (false);
}
if(isEmpty(f1.division.value,"the Division.."))
{
alert(errMsg);
f1.division.focus();
return (false);
}
}
</script>
<?php
if($_SESSION["role"]==1)
{
?>
<h2>Student Registration</h2>
</div>
</div>
<!-- /. ROW -->
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<form method="post" role="form" enctype="multipart/form-data" onSubmit="return validate_form(this)">
<div class="form-group">
<label>First Name:</label>
<input class="form-control" id="firstname" name="firstname" placeholder="Enter First Name"/>
</div>
<div class="form-group">
<label>Last Name:</label>
<input class="form-control" id="lastname" name="lastname" placeholder="Enter Last Name" />
</div>
<div class="form-group">
<label>Roll No. :</label>
<input class="form-control" id="s_rn" name="s_rn" placeholder="Enter Roll Number" onKeyPress="num_check(event)"/>
</div>
<div class="form-group">
<label>Gender:</label>
<div class="radio">
<label>
<input type="radio" id="s_gen" name="s_gen" value="0"/>Male
</label>
</div>
<div class="radio">
<label>
<input type="radio" id="s_gen" name="s_gen" value="1"/>Female
</label>
</div>
</div>
<div class="form-group">
<label>Email Id :</label>
<input class="form-control" id="email" name="email" placeholder="Enter Email Id" pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"/>
</div>
<div class="form-group">
<label>Contact Number. :</label>
<input class="form-control" id="cn" name="cn" maxlength="10" placeholder="Enter Contact Number" onKeyPress="num_check(event)"/>
</div>
<div class="form-group">
<label>Select Stream:</label>
<select class="form-control" id="c_idr" name="c_idr">
<option value="">Select Stream</option>
<?php if(isset($crs)){$cnt=0;foreach($crs as $c){$cnt++; ?>
<option value="<?php echo $c->c_id; ?>"><?php echo $c->cname; ?></option>
<?php if($cnt=='2'){break;}}}?>
</select>
</div>
<div class="form-group">
<label>Select Semester:</label>
<select class="form-control" id="semr" name="semr" style="">
<option value="">Select Semester</option>
<option value="1">Sem 1</option>
<option value="2">Sem 2</option>
<option value="3">Sem 3</option>
<option value="4">Sem 4</option>
<option value="5">Sem 5</option>
<option value="6">Sem 6</option>
<option value="7">Sem 7</option>
<option value="8">Sem 8</option>
<option value="9">Sem 9</option>
<option value="10">Sem 10</option>
</select>
</div>
<div class="form-group">
<label>Select Division:</label>
<select class="form-control" id="division" name="division" style="">
<option value="">Select Division</option>
<option value="a">Div A</option>
<option value="b">Div B</option>
<option value="c">Div C</option>
</select>
</div>
<center>
<button type="submit" id="submit" name="R_submit" value="Register" class="btn btn-primary" >Register</button>
</center>
</form>
</center>
<?php
}
else {
?>
<div class="row">
<div class="col-md-12"></div>
<img src="img/ad.jpg">
<?php
}
include 'footer.php';
?>