-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvote_result.php
More file actions
73 lines (68 loc) · 2.43 KB
/
vote_result.php
File metadata and controls
73 lines (68 loc) · 2.43 KB
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
<?php include('voteHead.php');
include('sess.php');
include('database/dbcon.php');
?>
<body>
<div id="row">
<?php
include('side_bar.php');
$postes = $conn->query("SELECT `class_name` FROM `postes`") or die(mysqli_errno());
if (isset($_POST['submit'])) {
while ($poste = $postes->fetch_array()) {
if (!isset($_POST[$poste['class_name'] . "_id"])) {
$_SESSION[$poste['class_name'] . "_id"] = "";
} else {
$_SESSION[$poste['class_name'] . "_id"] = $_POST[$poste['class_name'] . "_id"];
}
}
}
?>
</div>
<center>
<div class="col-lg-8" style="margin-left:240px;">
<?php
$flag = true;
$postes = $conn->query("SELECT `name` , `class_name` FROM `postes`") or die(mysqli_errno());
while ($poste = $postes->fetch_array()) {
?>
<div class="alert <?php $flag = !$flag; echo !$flag ? "alert-info" : "alert-success";?>">
<label><?php echo $poste['name']; ?></label>
<br />
<?php
if (!$_SESSION[$poste['class_name']."_id"]) {
} else {
$fetch = $conn->query("SELECT * FROM `candidate` WHERE `candidate_id` = " . $_SESSION[$poste["class_name"] . "_id"])->fetch_array();
echo $fetch['firstname'] . " " . $fetch['lastname'] . " " . "<img src = 'admin/" . $fetch['img'] . "' style = 'height:80px; width:80px; border-radius:500px;' />";
}
?>
</div>
<?php
}
?>
<br />
<button style="margin-bottom:20px;" type="submit" data-toggle="modal" data-target="#result" class="btn btn-success">Submit Final Vote</button>
</div>
</center>
<div class="modal fade" id="result" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">
Submission Confirmation
</h4>
</div>
<div class="modal-body">
<p class="alert alert-danger">Are you sure you want to submit your Vote? </p>
</div>
<div class="modal-footer">
<a href="submit_vote.php"><button type="submit" class="btn btn-success"><i class="icon-check"></i> Yes</button></a>
<a href="vote.php"><button class="btn btn-danger" aria-hidden="true"><i class="icon-remove icon-large"></i> Back</button></a>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</body>
<?php include('scripts/script.php') ?>
</html>