-
Notifications
You must be signed in to change notification settings - Fork 2
/
queryview.php
53 lines (49 loc) · 1.67 KB
/
queryview.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
<?php
$title = "View Records";
require_once './includes/header.php';
require_once './includes/auth_check.php';
require_once './db/conn.php';
require './includes/sanitise.php';
if (isset($_GET['id'])) {
$qid = test_input($_GET['id']);
$qstatus = test_input($_GET['status']);
$updatesuccess = $crud->updateQuery($qid,$qstatus);
if ($updatesuccess) {
include './includes/successmessage.php';
}
else{
include './includes/errormessage.php';
}
}
$results = $crud->getQueries();
?>
<table class="table">
<tr>
<th>Mail</th>
<th>Contact</th>
<th>Content</th>
<th>Date</th>
<th>Actions</th>
</tr>
<?php while ($r = $results->fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<td><?php echo $r['qmail'] ?></td>
<td><?php echo $r['qcontact'] ?></td>
<td><?php echo $r['qcontent'] ?></td>
<td><?php echo $r['qdate'] ?></td>
<td>
<?php if ($r['qstatus'] == 1) {?>
<a href="#" class="btn btn-success">Answered</a>
<?php }
else{
?>
<a href="./queryview.php?id=<?php echo $r['qid'] ?>&status=1" class="btn btn-warning">Pending</a>
<?php }?>
<a onclick="return confirm('Are you sure you want to delete this record?')" href="deletequery.php?id=<?php echo $r['qid'] ?>" class="btn btn-danger">Delete</a>
</td>
</tr>
<?php }?>
</table>
<?php
require './includes/footer.php'
?>