<html>
<head>
    <meta charset="utf-8"/>
   <title>PRAYATNA - Coord - Enter Event Attendance DB</title>
	<link rel="stylesheet" href="admin_table.css">
	<link href="https://fonts.googleapis.com/css2?family=Asap+Condensed&display=swap" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@500&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Arizonia&display=swap" rel="stylesheet">
</head>
<body>
<?php
    require('db.php');
    session_start();
    // When form submitted, check and create user session.
        // Check user is exist in the database
		//$selectedRow=$_POST['selectdelete'];
		//$query    = "DELETE FROM coord WHERE cid='$selectedRow'";
if(isset($_POST['submitupdateattendance'])){
//echo implode(", ",$selectdelete);
//echo $selectdelete[0];
  if(isset($_POST['selectupdateattendance'])){
	  //echo $selectdelete[0];
    foreach($_POST['selectupdateattendance'] as $updateid){
      //echo "id ".$deleteid." ";
      //$deleteUser = "DELETE from user WHERE userid='$deleteid'";
	  $ecode=$_SESSION['ecode'];
	  //echo $ecode." ".$updateid;
	  $updateUser = "UPDATE participant SET attended=1 WHERE umobile=left('$updateid',10) AND ecode=left('$ecode',5)";
      $result=mysqli_query($con,$updateUser) or die(mysql_error());
	  //$rows = mysqli_num_rows($result);
	  //echo $rows;
    }
						header("Location: coord_dashboard.php");

  }
 }
        //$result = mysqli_query($con, $query) or die(mysql_error());
            echo "<div class='form'>
                  <h3>User attendance Updated</h3><br/>
                  </div>";
?>
<p></p>
<a href="coord_dashboard.php"> <input type = "button" value = "COORD DASHBOARD" class="add_button"></a>

</body>
</html>