<html>
<head>
    <meta charset="utf-8"/>
    <title>PRAYATNA - Coord Print Event Attendees</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>
<h1 class="login-title">Choose Event and Print Attendees</h1>
<?php
    require('db.php');
    session_start();
    // When form submitted, check and create user session.
        // Check user is exist in the database
		$cnamemobile= $_SESSION['cname']." - ".$_SESSION['mobile'];
        $query    = "SELECT * FROM `event` where cname='$cnamemobile'"; 
        $result = mysqli_query($con, $query) or die(mysql_error());
        $rows = mysqli_num_rows($result);
        if ($rows > 0) {
			//echo '<form action = "coord_print_attendees_db.php" method = "POST" name = "printattendeeform">';
			echo '<form action = "coord_print_event_attendance_final_pdf.php" method = "POST" target="_blank" name = "printattendeeform">';
            //echo "<table border='1'><tr><th>VIEW</th><th>EVENT CODE</th><th>EVENT NAME</th><th>VENUE</th><th>DATE</th><th>START TIME</th><th>EVENT DURATION</th><th>COORDINATOR NAME</th></tr>";
			echo "<table border='1'><tr><th>VIEW</th><th>EVENT CODE</th><th>EVENT NAME</th><th>VENUE</th><th>DATE</th><th>START TIME</th><th>EVENT DURATION</th></tr>";
			while($record = mysqli_fetch_array($result))
			{
	        echo '<tr><td><center><input type = "radio" style = "inline" name ="selectprintattendees[]" value="'.$record['ecode'].'>"</td></center>';
			echo "<td><center>" . $record['ecode'] . "</center></td><td><center>" . $record['ename'] . "</center></td><td><center>" . $record['venue'] . "</center></td><td><center>" . $record['edate'] . "</center></td><td><center>" . $record['stime'] . "</center></td><td><center>" . $record['duration'] . "</center></td></tr>";
			}
			echo "</table><br>";
			echo '<input type = "submit" value = "Print Event Attendance Sheet" class = "add_button" name = "submitprintattendees">';
            echo '</form>';
              
        } else {
            echo "<div class='form'>
                  <h3>No events are added</h3><br/>
                  </div>";
        }
?>
<p></p>
<a href="coord_dashboard.php"> <input type = "button" value = "COORD DASHBOARD" class="add_button"></a>
</body>
</html>