<?php
session_start();
if(isset($_SESSION["admin"])){
    echo "fhgklsdafjg";

?>
<!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 - Edit Candidate</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';
        
        $candIC = isset($_POST["icCalon"]) ? trim($_POST["icCalon"]) : '';
        
        $q = "select * from tblcandidate WHERE candIC='$candIC'";
        $query = mysqli_query($conn,$q);
        $count1=mysqli_num_rows($query);
    if($count1 ==1){
   
    $row1 = mysqli_fetch_assoc($query);
    $IC = $row1['candIC'];
 
    $name = $row1['candName'];
    $candCourse = $row1['candCourse'];
    $candPost = $row1['candPost'];
    $candN = $row1['candN'];
    $image = $row1['image'];
    
?>
<div class="container">
    <form name="update" method="post" action="update4.php" enctype="multipart/form-data">
        <input type="hidden" name="var1" value="<?=$candIC?>"/>
        NO KAD PENGENALAN : <input type="text" name="candIC" value="<?php echo $IC;?>"><br><br>
        NAMA :   <input type="text" name="candName" value="<?php echo $name;?>"><br><br>
        KELAS :   <input type="text" name="candCourse" value="<?php echo $candCourse;?>"><br><br>
        JAWATAN : <input type="text" name="candPost" value="<?php echo $candPost;?>"><br><br>
        NAMA SINGKAT :   <input type="text" name="candN" value="<?php echo $candN;?>"><br><br>
        GAMBAR SEMASA : <br><img src="<?php echo $image; ?>" alt="Gambar calon" style="max-width:180px;height:auto;"><br><br>
        KEMASKINI GAMBAR : <input type="file" name="image" accept="image/*"><br><br>
      
        <input type="submit" name="submit" value="EDIT"><input type="submit" name="delete" value="DELETE">
    </form>
        <?php
    }else{
    echo "<h3>data tiada dalam database</h3>";
    echo $count1;
    }
}else{
     header("Location: ../index.php?error= You are not logged in");
}
 ?>
</div>
</body>
</html>