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

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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:11px;"></p>
</style>

</head>
<body>
<br/>
<h4>ΕΠΙΛΟΓΗ ΜΑΘΗΤΗ/ΤΡΙΑΣ</h4>
<?php 
require("dbconnect.php");
$usr=$_SESSION['usr'];
if (!empty($_GET['mit']))
{
	$mitroo=$_GET['mit'];echo $mitroo;
	mysqli_query($con,"delete from allstudentinfo where mitroo='$mitroo' ");
	echo "ΤΑ ΣΤΟΙΧΕΙΑ ΤΟΥ ΜΑΘΗΤΗ-ΤΡΙΑΣ ΕΧΟΥΝ ΔΙΑΓΡΑΦΕΙ";
}
else if (isset($_POST['kata']))
{
	$mitroo=$_POST['mitroo'];
	$new=$_POST['newx'];
	$enroll=$_POST['enroll'];
	$eponimo=$_POST['eponimo'];
	$onoma=$_POST['onoma'];
	$tmima=$_POST['tmima'];
	$omp=$_POST['omp'];
	$sex=$_POST['sex'];
	$address=$_POST['address'];
	$poli=$_POST['poli'];
	$tk=$_POST['tk'];
	$pateras=$_POST['pateras'];
	$pateras=$_POST['pateras'];
	$kpatera=$_POST['kpatera'];
	$mitera=$_POST['mitera'];
	$kmiteras=$_POST['kmiteras'];
	$kmathiti=$_POST['kmathiti'];
	$kinito=$_POST['kinito'];
	$stathero=$_POST['stathero'];
	$birthday=$_POST['birthday'];
	$identity=$_POST['identity'];
	if ($new==0)
	{
		mysqli_query($con,"delete from allstudentinfo where mitroo='$mitroo' ");
	}
	$sql = "insert into allstudentinfo (mitroo,enroll,omp,sex,eponimo,onoma,tmima,address,poli,tk,
	pateras,kpatera,mitera,kmiteras,kmathiti,kinito,stathero,birthday,identity) values 
	('$mitroo','$enroll','$omp','$sex','$eponimo','$onoma','$tmima','$address','$poli','$tk','$pateras','$kpatera',
	'$mitera','$kmiteras','$kmathiti','$kinito','$stathero','$birthday','$identity') ";
	if (mysqli_query($con, $sql)) 
	{
       echo "Η εγγραφή-διόρθωση για ".$mitroo. " ήταν επιτυχής";
    } 
	else 
	{
       echo "Λάθος: " . $sql . "<br>" . mysqli_error($con);
    }
}
else if (isset($_POST['delm']))
{
		$mitroo=$_POST['mitroo'];
		
}
?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>

</body>
</html>