<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>KVS DIGITAL - E-VOTING SYSTEM</title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  <!-- Favicons -->
  <link href="assets/img/kvs.png" rel="icon">
  <link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">

  <!-- Google Fonts -->
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Raleway:300,300i,400,400i,500,500i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">

  <!-- Vendor CSS Files -->
 	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/vendor/icofont/icofont.min.css" rel="stylesheet">
  <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <link href="assets/vendor/owl.carousel/assets/owl.carousel.min.css" rel="stylesheet">
  <link href="assets/vendor/venobox/venobox.css" rel="stylesheet">
  <link href="assets/vendor/aos/aos.css" rel="stylesheet">

  <!-- Template Main CSS File -->
  <link href="assets/css/style.css" rel="stylesheet">

  <!-- =======================================================
 
  ======================================================== -->
</head>

<body>

  <!-- ======= Header ======= -->
  <header id="header" class="fixed-top">
    <div class="container d-flex align-items-center">
      
      <div class="logo mr-auto">      
        
        <!-- Uncomment below if you prefer to use an image logo -->
        <a class="navbar-brand" href="#"></a>
          <h1 class="text-light"><a href="index.php">KVS DIGITAL E- VOTING</h1><h5>ADMIN page</h5></a>
        </a>
      </div>

      <nav class="nav-menu d-none d-lg-block">
        
        <ul>
          <li class="active"><a href="admin.php">Home</a></li>
          <li class="get-started"><a href="logout.php">logout</a></li>
        
        </ul>
      </nav><!-- .nav-menu -->

    </div>
  </header><!-- End Header -->
  </div>
  </div>
<br><br><br><br><br><hr>
<?php
include 'dbconn.php';

//counting total vote

$sql = "SELECT * FROM tblstudent WHERE voteStatus = 1";
$result = mysqli_query($conn, $sql);
$sql1 = "SELECT * FROM tblstudent";
$result1 = mysqli_query($conn, $sql1);
$rowcount=mysqli_num_rows($result1);
?>
</div>
<div class="container">
 
  <div id="printArea">
<table class="table table-striped">
<thead><h2>SENARAI PELAJAR YANG MENGUNDI</h2></thead>

<tbody>
  <tr>
    <th>ID Pelajar</th>
    <th>IC Pelajar</th>
    <th>Nama</th>
    <th>Kelas</th>
    
  </tr>

</tbody>
<?php
$total=0;
while($row = mysqli_fetch_assoc($result)) {
$total = $total+1;
?>

<tr>
  <td><?php echo $total;?></td>
 <td><?php echo $row["studentName"];?></td>
  <td><?php echo $row["studentClass"];?></td>
</tr>
<?}
echo "<br>JUMLAH PELAJAR MENGUNDI :".$total;
$peratus = 100-($total/$rowcount)*100;
echo "<br>PERATUS TIDAK KELUAR MENGUNDI :".round($peratus,2);
?>
</table>
</div>
<button class="btn btn-info" onclick="printSpecificArea()">CETAK</button>
<?php

echo "kdjgas";
?>
</div>
<?php

echo "kdjgasetweqrter";

echo "kdjgas    sfsadhdfsjfgdjfgd";
//}
?>
<!-- ======= Footer ======= -->
  <footer id="footer">
    <div class="container py-4">
      <div class="copyright">
        &copy; Copyright 2021<strong><span>kvsdigital.my </span></strong>. All Rights Reserved
      </div>
      <div class="credits">
        <!-- All the links in the footer should remain intact. -->
        <!-- You can delete the links only if you purchased the pro version. -->
        <!-- Licensing information: https://bootstrapmade.com/license/ -->
        <!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/free-bootstrap-app-landing-page-template/ -->
        Designed by Bootstrap</a>
      </div>
    </div>
  </footer><!-- End Footer -->

  <a href="#" class="back-to-top"><i class="icofont-simple-up"></i></a>
<script>
        function printSpecificArea() {
            var printContents = document.getElementById('printArea').innerHTML;
            var originalContents = document.body.innerHTML;

            document.body.innerHTML = printContents;

            window.print();

            document.body.innerHTML = originalContents;
            location.reload();  // Refresh the page to restore the original contents
        }
    </script>
<!-- Vendor JS Files -->
  <script src="assets/vendor/jquery/jquery.min.js"></script>
  <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="assets/vendor/jquery.easing/jquery.easing.min.js"></script>
  <script src="assets/vendor/php-email-form/validate.js"></script>
  <script src="assets/vendor/owl.carousel/owl.carousel.min.js"></script>
  <script src="assets/vendor/venobox/venobox.min.js"></script>
  <script src="assets/vendor/aos/aos.js"></script>

  <!-- Template Main JS File -->
  <script src="assets/js/main.js"></script>
</body>
</html>