<?php
include "scrinit.php";
include $menu;
?>

<html>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<head>
</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">

function popupCenter(pageURL, title, w, h) {
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800, height=800, top='+top+', left='+left);
}
</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:14px; }
<p style="font-size:14px;"></p>
</style>
</head>
<body>
<h2>Επιλογή συνδιδασκαλίας για εκτύπωση</h2>
<?php
require "dbconnect.php"; 

$result = mysqli_query($con,"SELECT synd,kathigitis,pmp FROM syndkath order by synd ASC" ); 
$result1 = mysqli_query($con,"SELECT DISTINCT tmima FROM allstudentinfo order by tmima ASC" );    
 
echo "<table class='myTable' >
<tr style='border:2px solid black' >
</tr>";
echo "<tr > 
<th>Α/Α</th>
<th>ΤΜΗΜΑ/ΣΥΝΔ.</th>
<th>ΚΑΘΗΓΗΤΗΣ/ΤΡΙΑ</th>
</tr>";
$tmima=$kath=$scode=array();
$i=1;
while($row = mysqli_fetch_array($result1))
	  {
	  $tmima[$i]=$row['tmima'];
	  $kath[$i]=" ";
	  $i++;
	  } 
 while($row = mysqli_fetch_array($result))
     {
	  $tmima[$i]=$row['synd'];
	  //$scode[$i]=$row['syndid'];
	  $kath[$i]=$row['kathigitis'];
	  $i++;
	  }
 
 $i--;
 
 for ($k=1;$k<=$i;$k++){
      echo "<td>" . $k. "</td>";
	  $pcode=$tmima[$k]."/".$scode[$k];
	 ?>
     <td>
   <a href="#" onClick="popupCenter('psynd.php?syndx=<?php echo $pcode; ?>')"><?php echo $tmima[$k]; ?></a>
    </td>
<?php
      echo "<td>" . $kath[$k]. "</td>";
      echo "</tr>";
     
     }
echo "</table>"; 
 

?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού   </a>

</body>
</html>