-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.php
136 lines (134 loc) · 4.68 KB
/
results.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
<?php include_once 'conn.php' ?>
<!doctype html>
<html>
<head>
<title> Feedback Data </title>
</head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>
<?php
$sql_response1 = "SELECT AVG(response1) FROM responses;";
$sql_response2 = "SELECT AVG(response2) FROM responses;";
$sql_response3 = "SELECT AVG(response3) FROM responses;";
$sql_response4 = "SELECT AVG(response4) FROM responses;";
$sql_text = "SELECT feedback_text FROM responses;";
$result1 = mysqli_query($connect, $sql_response1);
$result2 = mysqli_query($connect, $sql_response2);
$result3 = mysqli_query($connect, $sql_response3);
$result4 = mysqli_query($connect, $sql_response4);
$result_text = mysqli_query($connect, $sql_text);
$disp_r1 = mysqli_fetch_assoc($result1);
$disp_r2 = mysqli_fetch_assoc($result2);
$disp_r3 = mysqli_fetch_assoc($result3);
$disp_r4 = mysqli_fetch_assoc($result4);
?>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
font-size: 30px;
}
th{
background-color: #ff4800;
color: white;
}
ol, li {
font-size: 30px;
}
tr:nth-child(even) {background-color: #f2f2f2;}
tr:hover {background-color: #65d6d8;}
td{
text-align: center;
}
/* Style the button that is used to open and close
the collapsible content */
.collapsible {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
/*width: 100%;*/
border: none;
text-align: left;
outline: none;
font-size: 30px;
}
/* Add a background color to the button if it is clicked on
(add the .active class with JS), and when you move the mouse over
it (hover) */
.active, .collapsible:hover {
background-color: #ccc;
}
/* Style the collapsible content. Note: hidden by default */
.content {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #f1f1f1;
}
</style>
<div style="overflow-x:auto;">
<table align = "center">
<tr>
<th><b><i>S. No.</b></i></th>
<th><b><i>Query</i></b></th>
<th><b><i>Average Response</b></i></th>
</tr>
<tr>
<td>1</td>
<td>Are you satisfied with our products?</td>
<td>
<?php echo round($disp_r1['AVG(response1)'],2); ?>
</td>
</tr>
<tr>
<td>2</td>
<td>Do you find our products easy to use?</td>
<td>
<?php echo round($disp_r2['AVG(response2)'],2); ?>
</td>
</tr>
<tr>
<td>3</td>
<td>How much impact our products have made on your daily routine?</td>
<td>
<?php echo round($disp_r3['AVG(response3)'],2) ?>
</td>
</tr>
<tr>
<td>4</td>
<td>Would you recommend our products to your friends and family? </td>
<td>
<?php echo round($disp_r4['AVG(response4)'],2) ?>
</td>
</tr>
</table>
</div>
<br><br><br><button class="collapsible">Text Feedbacks</button>
<div class="content">
<ol>
<?php
while($row = mysqli_fetch_array($result_text)){
if($row['feedback_text']!="")
echo "<li>".$row['feedback_text']."</li>";
}
?>
</ol>
</div>
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
</script>
</body>
</html>