<?php 
include "scrinit.php";
include $menu;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<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 green;padding:2px;font-size:10pt; }
<p style="font-size:10px;"></p>
</style>

<title>Προσθήκη Συνδιδασκαλίας</title>

<?php 

require("dbconnect.php");
$usr=$_SESSION['usr'];
$access=$_SESSION['access'];
$dt=$_SESSION['dt'];
$dtc= date('d-m-Y', strtotime($dt));
if (!($access == 4 or $access == 9)) { echo " *** ΜΗ ΔΙΑΘΕΣΙΜΕΣ ΔΙΑΔΙΚΑΣΙΕΣ *** ";}
else
{
$result = mysqli_query($con,"SELECT Name,PMP FROM teachers ORDER BY Name ");

?>
<h4> ΕΠΕΛΕΞΕ ΕΚΠΑΙΔΕΥΤΙΚΟ </h4>
<form  method='post' ">
<div style="overflow:scroll; border:1px solid black;background:#F5F9F0;width:320px; height: 450px">

<?php
echo "<table style='width:300px' class='myTable' >
<tr style='border:1px solid black' bgcolor='#adcd82'  >
<th>ΚΑΘΗΓΗΤΗΣ/ΚΑΘΗΓΗΤΡΙΑ</th>
<th> </th>
<th>ΕΠΙΛΟΓΗ</th>
</tr>";
$i=1;
while ($row = mysqli_fetch_array($result)) 
  { 
    $namep=$row['Name']."/".$row['PMP'];
	$namet=$row['Name'];
	echo "<tr>";
	echo "<td>".$namet."</td>";
	echo "<td>"." "."</td>";
    echo "<td ALIGN=center>"."<input type='radio' name='oksx' value='$namep' >"."</td>";
	echo "</tr>";
    $i++;
}
echo "</table>";
echo "<input type='hidden' name='pmp' value='$pmp' >"."</td>";
?>
</div>
<br>
<input type="submit" name="epsynd" value="Επιβεβαίωση Επιλογής" >
<br>
</form>
<?php
if (isset($_POST['epsynd']))
{
    $all=explode("/",$_POST['oksx']);
	$pmp=$all[1];
	$teach=$all[0];
	$sql = $dbcon->prepare("SELECT synd FROM syndkath WHERE pmp = ? ");
	$sql->execute([$pmp]);
	echo "<table style='width:100px' class='myTable' >
	<tr style='border:1px solid black' bgcolor='#adcd82'  >
	<th>Α/Α</th>
	<th>ΣΥΝΔΙΔΑΣΚΑΛΙΑ</th>
	</tr>";
	?>
	<form  method='post' action='addsynd1.php' ">
	<?php
	$i=1;
	while ($row=$sql->fetch(PDO::FETCH_ASSOC))
	{
		$syndo=$row['synd'];
		echo "<tr>";
		echo "<td>".$i."</td>";
		echo "<td ALIGN=center>".$syndo."</td>";
		echo "</tr>";
		$i++;
	}
	echo "<tr>";
	echo "<td>".$nextid."</td>";
	echo "<td ALIGN=center>"."<input type='text' name='syndx' value='' >"."</td>";
	echo "<input type='hidden' name='pmpx' value='$pmp' >"."</td>";
	echo "<input type='hidden' name='teachx' value='$teach' >"."</td>";
	echo "</tr>";
	echo "</table>";
?>	
<br>
<input type="submit" name="adsynd" value="Προσθήκη Συνδιδασκαλίας" >
</form>
<?php

}
}
?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Ακύρωση Διαδικασίας και Επιστροφή στο Μενού  </a>
</body>
</html>