<?php
include "scrinit.php";
require("dbconnect.php");
echo "<br>"."  ΗΜΕΡΟΜΗΝΙΑ : ".$date."<br>";
echo "<br>"."ΚΑΤΑΛΟΓΟΣ ΑΠΟΝΤΩΝ ΜΑΘΗΤΩΝ :". "<br>"."<br>";
echo "<table class='myTable' >
<tr style='border:1px solid black;font-size:9px'  >
<tr>
<th>α/α</th>
<th>Μητρώο</th>
<th>Τμήμα</th>
<th>Επώνυμο</th>
<th>Όνομα</th>
<th>ΑΠΟΥΣΙΑ</th>";
for ($i=1;$i<=$gym;$i++)
{
	$titep="Περ".$i;
	echo "<th>".$titep."</th>";
}
echo "</tr>";
$n=count($mitr);
$sql1= $dbcon->prepare("SELECT tmima,eponimo,onoma FROM allstudentinfo WHERE mitroo=?");
if ( $n> 0) 
{  $i=1;
   foreach ($mitr as $mtr)
   { 
     $sql1->execute([$mtr]);
	 $row=$sql1->fetch(PDO::FETCH_ASSOC);
	 $tm=$row['tmima'];
	 $epo=$row['eponimo'];
	 $nm=$row['onoma'];
	 echo "<tr>";
	 echo "<td>" .$i;
	 echo "<td>". "<input type='text' name='mt[]' value='$mtr' size=12>" . "</td>";
	 echo "<td>". "<input type='text' name='tm[]' value='$tm' size=12 >" . "</td>";
	 echo "<td>". "<input type='text' name='epo[]' value='$epo' >" . "</td>";
     echo "<td>". "<input type='text' name='nm[]' value='$nm' >" . "</td>";
	 for($k=1;$k<=$gym;$k++){$pr[$k]=0;}
	 for($k=$papo;$k<=$pm;$k++){$pr[$k]=1;}
	 ?>
     <td>
     <input type='checkbox' name='ok[]' value='$ok' checked /> 
     </td>
	 <?php
     for ($j=1;$j<=$gym;$j++)
	 {
	   ?>
       <td>
       <input type='checkbox' name='p[]' value='$pr[$j]'   <?php if($pr[$j]==1) {echo 'checked';} else echo 'unchecked'; ?> /> 
       </td>
	   <?php
	 }
	 echo "</tr>";
	 $i++;
    }
echo "</table>";
}

