<?php
include "scrinit.php";
include "logo.php";
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:4px;font-size:14px; }
<p style="font-size:14px;"></p>
</style>
</head>
<body>
<?php

require("dbconnect.php");

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

if (isset($_POST['nameid'])) {$mitr=$_POST['nameid'];}
if (isset($_GET['nameid'])) {$mitr=$_GET['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 " Ο μαθητής δεν έχει τιμωρίες";
	echo "<br>";
	}
else
{
echo "<table class='myTable3' >
<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;       

}

?>
<br /><br />
<input type="button" name="epistrofi" value="Ακύρωση και Επιστροφή" onClick="self.close()"> 
</body>
</html>
