-
Notifications
You must be signed in to change notification settings - Fork 23
/
add_subject.php
159 lines (147 loc) · 4.6 KB
/
add_subject.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
<?php
include './Database/Controler.php';
include 'header_admin.php';
?>
<script src="https://code.jquery.com/jquery-1.12.4.js"> </script>
<script language="javascript" type="text/javascript">
function getSpec(sem)
{
var sp=document.getElementById("sp").value;
var cid=document.getElementById("cr").value;
if(sp==1)
{
$.ajax({
type:"GET",
url:"dropdown.php",
data:"add_spec_sub="+cid+" sem= "+sem,
success:function(result)
{
if(cid==1 && sp==1 && sem==9 || sem==10)
{
$("#add_spec").html(result);
}
}
});
}
}
</script>
<script language="javascript" src="./assets/js/validation.js"></script>
<script language="javascript">
function validate_form(f1)
{
if(isEmpty(f1.sid.value,"the subject Id.."))
{
alert(errMsg);
f1.sid.focus();
return (false);
}
if(isEmpty(f1.subnm.value,"the Subject Name.."))
{
alert(errMsg);
f1.subnm.focus();
return (false);
}
if(isEmpty(f1.cr.value,"the Course Name.."))
{
alert(errMsg);
f1.cr.focus();
return (false);
}
/*if(isEmpty(f1.sp.value,"the Status of Subject.."))
{
alert(errMsg);
f1.sp.focus();
return (false);
}*/
if(isEmpty(f1.type.value,"the Type of Subject.."))
{
alert(errMsg);
f1.type.focus();
return (false);
}
if(isEmpty(f1.sem.value,"the Semester.."))
{
alert(errMsg);
f1.sem.focus();
return (false);
}
}
</script>
<!-- /. ROW -->
<?php
if($_SESSION["role"]==1)
{
?>
<h2>Add Subject</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" onSubmit="return validate_form(this)">
<div class="form-group">
<label>Subject Id:</label>
<input class="form-control" id="sid" name="sid" placeholder="Enter Subject Id..For Practical write [prac] after subject id e.x. C[prac]"/>
</div>
<div class="form-group">
<label>Subject Name:</label>
<input class="form-control" id="subnm" name="subnm" placeholder="Enter Subject Name" />
</div>
<div class="form-group">
<label>Course:</label>
<select class="form-control" id="cr" name="cr">
<option value="">Select Course</option>
<option value="1">MBA</option>
<option value="0">MSC</option>
</select>
</div>
<div class="form-group">
<label>Special</label>
<select class="form-control" id="sp" name="sp" >
<option value="">No</option>
<option value="1">Yes</option>
</select>
</div>
<div class="form-group">
<label>Semester</label>
<select class="form-control" id="sem" name="sem" onchange="return getSpec(this.value)">
<option value="">Select Semester</option>
<?php
for($i=1;$i<=10;$i++)
{
?>
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
<?php }?>
</select>
</div>
<div class="form-group" id="add_spec">
</div>
<div class="form-group">
<label>Type</label>
<select class="form-control" id="type" name="type">
<option value="">Select Status</option>
<option value="1">Core</option>
<option value="2">Elective</option>
</select>
</div>
<center>
<button type="submit" id="sub_submit" name="sub_submit" value="Submit" class="btn btn-primary" >Submit</button>
</center>
</form>
</center>
<?php
}
else
{
?>
<div class="row">
<div class="col-md-12"></div>
<img src="img/ad.jpg">
<?php
}
include 'footer.php';
?>