<?php
include "scrinit.php";
include "logo.php";
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>


<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:12px; }
<p style="font-size:11px;"></p>
</style>

<body>
<?php

require("dbconnect.php");

$dt=$_SESSION['dt'];
$name = $_SESSION['n'];

if (isset($_POST['nameid'])) {$mitr=$_POST['nameid'];}

$sql = mysqli_query($con,"SELECT eponimo,onoma,tmima FROM allstudentinfo WHERE mitroo='$mitr'  " );
$row = mysqli_fetch_array($sql);
$stname=$row['eponimo']." ".$row['onoma'];
$tmima=$row['tmima'];
$_SESSION['mitr']=$mitr;

echo " ΤΙΜΩΡΗΜΕΝΕΣ ΚΑΘΥΣΤΕΡΗΣΕΙΣ ΓΙΑ ". " "."<b>".$stname."</b>"." "." του τμήματος ".$tmima."<br>"."<br>";

$sql = mysqli_query($con,"SELECT * FROM apousies  WHERE   timoriacode > 0 AND mitroo='$mitr' ORDER BY dateout" );

if (mysqli_num_rows($sql)==0){
	echo " Ο μαθητής δεν έχει τιμωρίες";}
else
{
echo "<table class='myTable' >
<tr style='border:1px solid black' >
</tr>";
echo "<th>α/α</th>

<th>Ημερομηνία</th>
<th>Περίοδ.</th>
<th>Καθυστ.</th>
<th>Κωδικός Τιμωρίας</th>
</tr>";

$i=1;
while ($row = mysqli_fetch_array($sql)) 
{ 
	 echo "<tr>";
	 echo "<td>" .$i; 
	 echo "<td>". $row['dateout'];
	 echo "<td>". $row['period'];
	 echo "<td>". $row['kath'];
	 echo "<td>". $row['timoriacode'];
	 echo "</tr>";
	 $i++;
}
echo "</table>";	

echo "<br>"."<br>"."<br>";
echo "<b>"."ΑΝΑΚΛΗΣΗ ΚΑΘΥΣΤΕΡΗΣΕΩΝ / ΔΩΣΕ ΚΩΔΙΚΟ ΤΙΜΩΡΙΑΣ"."</b>";

// define the form into a variable
$fhtml = '<form  action="timoriadel.php" method="post">
<input type="text" name="code"  >
<input name="submita" type="submit" value="SUBMIT" />
</form>';

echo $fhtml;       


}
//<a  href="timoria1.php" style="color:blue "> <button>Επιστροφή</button> </a>&nbsp&nbsp
?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "><button>Επιστροφή στο Μενού</button></a>&nbsp&nbsp 
<a  href="kathisterisi.php" style="color:blue "><button>Λίστα Καθυστερήσεων</button>  </a>
</body>
</html>
