<?php
include "scrinit.php";
include $menu;
?><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>
<script type="text/javascript">
	function pop_up(url){
		window.open(url,'win2','toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=200, width=1100, height=800') 
	}
</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:11px; }
<p style="font-size:09px;"></p>
</style>
<?php
require "dbconnect.php";
$usr=$_SESSION['usr'];
$date=$_SESSION['dt'];
$eid=" ";
if (isset($_POST['eidik']))
{
	$eid=$_POST['eidikotita'];
}
echo "<p class='p1'>"."ΕΠΙΛΟΓΗ ΕΙΔΙΚΟΤΗΤΑΣ:"."</p> ";
$sql = mysqli_query($con,"SELECT * FROM vdsint WHERE pmp='$usr' " );	
?>
<form  method="post"  > 
<?php

$c=mysqli_num_rows($sql);
echo "<select name='eidikotita'>";
while ($row = mysqli_fetch_array($sql)) 
{
   	$e=$row['mathima'];
	?><option value =<?php echo $e; ?> <?php if($e == $eid) echo "selected";?> > <?php echo $row['mathima']; ?></option><?php
}
echo "</select>";
?>	
<input type="Submit" name="eidik" value="ΕΠΙΛΟΓΗ ΕΙΔΙΚΟΤΗΤΑΣ" >

</form>	

<?php

if (isset($_POST['eidik'])) 
{
$dat=$_SESSION['dt'];
$eid=trim($_POST['eidikotita']);
$_SERVER['PHP_SELF'];

$sql0=mysqli_query($con,"select Name,PMP from teachers where trim(idikotita)='$eid' order by Name");	
$c=mysqli_num_rows($sql0);
$suball=array();
$cn=0;$maxk=0;
while ($row0 = mysqli_fetch_array($sql0)) 
{
	$cn++;
	$pmp[$cn]=$row0['PMP'];
	$nam[$cn]=$row0['Name'];
	$usr=$row0['PMP'];
	include "selectmath.php";
	$k=0;
	foreach($mathsubj as $subp)
	{
		$k++;
		$suball[$cn][$k]=$subp;
	}
	if($k > $maxk)$maxk=$k;
}

echo "<p class='p1'>"."ΔΙΔΑΣΚΟΝΤΕΣ ΑΝΑ ΕΙΔΙΚΟΤΗΤΑ/ΜΑΘΗΜΑ"."</p> ";
echo "<table class='myTable3' >
<tr style='border:1px solid black;font-size:12px'  >
<tr>
<th>ΕΚΠΑΙΔΕΥΤΙΚΟΣ</th>";
echo "<th colspan='".$maxk."'>ΒΑΘΜΟΛΟΓΙΕΣ</th>
</tr>";
for ($j=1;$j<=$cn;$j++)
{
	echo "<tr>";
	echo "<td>".$nam[$j]."</td>";
	for ($n=1;$n<=$maxk;$n++)
	{
		$subx=$suball[$j][$n]."/".$pmp[$j];
		echo "<td>"."<a href=\"bathmosanakath.php?mathid=".$subx."\" onclick=\"pop_up(this.href);return false\">"."<b>".$suball[$j][$n]."</b>". "</a>". "</td>";
	    //echo '<td><center><img src="icons/progr.png" onclick="progr(\''.$suball[$j][$n].'\')" width="30" height="30" /></center></td>';
	}
	echo "</tr>";
}
echo "</table>";
$usr=$_SESSION['usr'];

}
?>
</body>
</html>