<?php
include "scrinit.php";
?>
<!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>

<body>
<?php 
require("dbconnect.php");
	$mti = $_POST['mt'];
	$syndid=$_POST['syndid'];
	$epilogi = $_POST['att'];
	$c = count($epilogi);
	//echo $c."xx".$syndid;
	//echo $_POST['sdel'];echo $_POST['sadd'];
	//print_r($_POST);
	//echo $kathig.$synd;
    if (isset($_POST['sdel']	))
	{
	//echo "in";	
      mysqli_query($con,"DELETE FROM syndidaskalies WHERE syndid='$syndid'");
	  mysqli_query($con,"DELETE FROM syndcodes WHERE syndid='$syndid'");
	  echo "Η ΣΥΝΔΙΔΑΣΚΑΛΙΑ ".$syndid." ΕΧΕΙ ΔΙΑΓΡΑΦΕΙ";
	  
    }
   if (!empty($epilogi))
    { 
	
	  mysqli_query($con,"DELETE FROM syndidaskalies WHERE syndid='$syndid' ");   
          foreach ($epilogi as $mit) 
	  {  
	    mysqli_query($con,"INSERT INTO syndidaskalies (syndid,mitroo) VALUES ('$syndid','$mit') ") ;
		
     	  }
     	   echo '<script type="text/javascript">';
    	   echo 'alert("Η Συνδιδασκαλία ενημερώθηκε")';
    		echo '</script>';	
    		$time = 0.1; //Time (in seconds) to wait. 
   		 echo '<script> window.setTimeout("window.close()", 1000); </script>';
    }
   


   
