-
Notifications
You must be signed in to change notification settings - Fork 1
/
viewsurvey.php
143 lines (134 loc) · 4.4 KB
/
viewsurvey.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
<?php
include("header.php");
include("connection.php");
$ressubplan = mysqli_query($con,"SELECT * FROM institute where inst_type='$_POST[institutetype]'");
$insttype="";
while($rtplan = mysqli_fetch_array($ressubplan))
{
$insttype[]= $rtplan[inst_id];
}
if(isset($_GET[sst]))
{
mysqli_query($con,"UPDATE survey SET status='$_GET[sst]' where surveyno='$_GET[sid]'");
}
$resulta = mysqli_query($con,"SELECT * FROM survey");
?>
<div id="main">
<div id="content" class="left">
<div class="highlight">
<h3>View institution</h3>
<form id="form1" name="form1" method="post" action="">
<p>
<label for="institutetype"> <a href="addsurvey.php"><strong>Add new Survey</strong></a> Institute Type</label>
<label for="selec"></label>
<label for="institutionname"></label>
<select name="institutetype" id="institutetype">
<option value="">Select Institution type</option>
<option value="Primary school" >Primary school</option>
<option value="High school">High school</option>
<option value="PUC">PUC</option>
</select>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
<table width="615" border="1">
<tr>
<th width="175" height="29" scope="col">Institution </th>
<th width="169" scope="col" >User </th>
<th width="63" scope="col">Year</th>
<th width="91" scope="col">Lastdate</th>
<th width="83" scope="col"><p>Status</p></th>
</tr>
<?php
if(isset($_POST[institutetype]))
{
for($j=0; $j< count($insttype); $j++)
{
$instype = "SELECT * FROM survey where inst_id = '$insttype[$j]'";
$resulta = mysqli_query($con,$instype);
while($rowa = mysqli_fetch_array($resulta))
{
echo "<tr>";
$resultc = mysqli_query($con,"SELECT * FROM institute where inst_id='$rowa[inst_id]'");
while($rowc = mysqli_fetch_array($resultc))
{
$instname = $rowc[inst_name];
}
echo "<td> ".$rowa[inst_id]. " - ". $instname. "</td>";
$resultb = mysqli_query($con,"SELECT * FROM user where user_id='$rowa[user_id]'");
while($rowb = mysqli_fetch_array($resultb))
{
$namess = $rowb[emp_fname]. " ". $rowb[emp_lname];
}
echo "<td> $namess</td>";
echo "<td> $rowa[year]</td>";
echo "<td> $rowa[lastdate]</td>";
if($rowa[status] == "Active")
{
$surveyst = "<a href='viewsurvey.php?sst=Deactive&sid=$rowa[surveyno]'><b>Deactivate</b></a>";
}
else if($rowa[status] == "Deactive")
{
$surveyst = "<b>Deactivated</b>";
}
echo "<td> $surveyst <br>
</td>";
echo "</tr>";
}
}
}
else
{
while($rowa = mysqli_fetch_array($resulta))
{
echo "<tr>";
$resultc = mysqli_query($con,"SELECT * FROM institute where inst_id='$rowa[inst_id]'");
while($rowc = mysqli_fetch_array($resultc))
{
$instname = $rowc[inst_name];
}
echo "<td> ".$rowa[inst_id]. " - ". $instname. "</td>";
$resultb = mysqli_query($con,"SELECT * FROM user where user_id='$rowa[user_id]'");
while($rowb = mysqli_fetch_array($resultb))
{
$namess = $rowb[emp_fname]. " ". $rowb[emp_lname];
}
echo "<td> $namess</td>";
echo "<td> $rowa[year]</td>";
echo "<td> $rowa[lastdate]</td>";
if($rowa[status] == "Active")
{
$surveyst = "<a href='viewsurvey.php?sst=Deactive&sid=$rowa[surveyno]'><b>Deactivate</b></a>";
}
else if($rowa[status] == "Deactive")
{
$surveyst = "<b>Deactivated</b>";
}
echo "<td> $surveyst <br>
</td>";
echo "</tr>";
}
}
?>
</table>
<p> </p>
</div>
<div class="projects">
<div class="item"></div>
<div class="item">
<div class="cl"> </div>
</div>
</div>
</div>
<?php
include("sidebar.php");
?>
<div class="cl"> </div>
</div>
<div class="shadow-l"></div>
<div class="shadow-r"></div>
<div class="shadow-b"></div>
</div>
<?php
include("footer.php");
?>