-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.php
119 lines (72 loc) · 2.52 KB
/
ajax.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
<?php
require_once('dbc.php');
//Ajax call for year where values are going to be fetch by program_id
if(isset($_POST['program_id'])&&!empty($_POST['program_id'])){
//echo $_POST['program_id'];exit;
$query = $db->query("SELECT * FROM intake WHERE program_id = ".$_POST['program_id']." GROUP BY year_id ASC");
$rowCount= $query->num_rows;
if($rowCount>0){
echo '<option value="">Select year</option>';
while($row=$query->fetch_assoc()){
echo '<option value="'.$row['year_id'].'">'.$row['year'].'</option>';
}
}
else{
echo '<option value"">Year Not Available</option>';
}
}
//Ajax call for city where values are going to be fetch by year_id
if(isset($_POST['year_id'])&&!empty($_POST['year_id'])){
$query=$db->query("SELECT * FROM intake WHERE year_id=".$_POST['year_id']." GROUP BY division ASC");
$rowCount=$query->num_rows;
if($rowCount>0){
echo '<option value="">Select division</option>';
while($row=$query->fetch_assoc()){
echo '<option value="'.$row['div_id'].'">'.$row['division'].'</option>';
}
}
else{
echo '<option value"">Division Not Available</option>';
}
}
if(isset($_POST['div_id'])&&!empty($_POST['div_id'])){
$query=$db->query("SELECT * FROM intake WHERE div_id=".$_POST['div_id']." ORDER BY semester ");
$rowCount=$query->num_rows;
if($rowCount>0){
echo '<option value="">Select Semester</option>';
while($row=$query->fetch_assoc()){
echo '<option value="'.$row['sem_id'].'">'.$row['semester'].'</option>';
}
}
else{
echo '<option value"">Semester Not Available</option>';
}
}
if(isset($_POST['sem_id'])&&!empty($_POST['sem_id'])){
$query=$db2->query("SELECT * FROM subject_table WHERE sem_id=".$_POST['sem_id']." ORDER BY subject_name ");
$rowCount=$query->num_rows;
if($rowCount>0){
echo '<option value="">Select Subject</option>';
while($row=$query->fetch_assoc()){
echo '<option value="'.$row['subject_no'].'">'.$row['subject_name'].'</option>';
}
}
else{
echo '<option value"">Subject Not Available</option>';
}
}
//Ajax call for Feedback
if(isset($_POST['year_id_feed'])&&!empty($_POST['year_id_feed'])){
$query=$db->query("SELECT * FROM intake WHERE year_id=".$_POST['year_id_feed']." GROUP BY semester ASC");
$rowCount=$query->num_rows;
if($rowCount>0){
echo '<option value="">Select Semester</option>';
while($row=$query->fetch_assoc()){
echo '<option value="'.$row['semester'].'">'.$row['semester'].'</option>';
}
}
else{
echo '<option value"">Semester Not Available</option>';
}
}
?>