-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsurveyMenu.php
75 lines (48 loc) · 1.76 KB
/
surveyMenu.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
<?php
session_start();
include "menu.php";
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mydb";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
//wehre Id = $selectedId
//$sql= "SELECT * FROM logs WHERE Id = 1";
$receiverId = $_SESSION['user']['Id'];
$sql = "SELECT survey.survey_name ,survey.survey_id
FROM survey_sent_to
JOIN survey
ON survey.survey_id = survey_sent_to.survey_id
WHERE survey_sent_to.user_id = $receiverId AND survey_sent_to.has_answered = 0
";
//$result = mysqli_query($conn,$sql);
$result = $conn->query($sql);
$allRecords = $result->fetch_all(MYSQLI_ASSOC);
if(count($allRecords) == 0)
{
echo "<h1> no surveys to show yet</h1>";
die;
}
?>
<!DOCTYPE html>
<html>
<head>
<link href="CSS/simple-sidebar.css" rel="stylesheet">
<title>Survey menu</title>
</head>
<body>
<div class="bg-dark border-right" id="sidebar-wrapper" >
<div class="list-group list-group-flush bg-dark " style= "width:40%;">
<?php foreach($allRecords as $record){
$surveyId = $record['survey_id'];
printf('<a href="Customer_surveyAnswer.php?Id=%s" class="list-group-item list-group-item-action bg-secondary text-light show"><span class="text-nowrap"><i class="fa fa-plus-square"></i> %s </a></span>',$record['survey_id'],$record['survey_name']);
}
?>
</div>
</div>
<?php
include 'footer.php'
?>
</body>
</html>