<?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:14px; }
<p style="font-size:11px;"></p>
</style>

</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(function() {
 $("#tmimaid").bind("change", function() {
     $.ajax({
         url: "change.php",
         data: "tmimaid="+$("#tmimaid").val(),
         success: function(html) {
             $("#nameid").html(html);
         }
     });
 }); 
});

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=1000, height=300, top='+top+', left='+left);
}
</script>

</head>
<body>

<br/><br/>
<h2>ΕΓΓΡΑΦΕΣ ΜΑΘΗΤΩΝ</h2>
<br/>
<h4>ΕΠΙΛΟΓΗ ΜΑΘΗΤΗ/ΤΡΙΑΣ</h4>
<?php 

require("dbconnect.php");
$usr=$_SESSION['usr'];
 
    $sql = mysqli_query($con,"SELECT eponimo,onoma,idnum FROM neoix order by eponimo,onoma");
    ?>
    
    <form method='POST'>
    
    <label> Μαθητής/τρια:</label>
	<select name='idnumx' >
    <?php
	echo "<option value='0'>***ΑΠΟ ΑΛΛΟ ΣΧΟΛΕΙΟ***</option>";
	while($row = mysqli_fetch_array($sql)) 
	{
		$idnum=$row['idnum'];
		$epo=$row['eponimo'];
		$nam=$row['onoma'];
		$name=$epo." ".$nam;
		$disp=$idnum." ".$name;
		echo "<option value='$idnum'>$disp</option>";
    } 
	?>
       
	</select>
	
   	<input type="submit" name="submit1" value="Επιβεβαίωση Επιλογής" >
    </form>
	<br><br><br>
	<h4>ΚΑΤΑΧΩΡΗΣΗ ΜΗΤΡΩΟΥ</h4>
<?php
if (isset($_POST['submit1']))
{
	$idnum=$_POST['idnumx'];
	$sql = mysqli_query($con,"SELECT * FROM neoix WHERE idnum='$idnum'  " );
	$row = mysqli_fetch_array($sql);
	$onoma=$row['onoma'];
	$eponimo=$row['eponimo'];
	?>
	<br>
	<form  method='post' action='eggrafes.php'>
	<table style='width:600px' class='myTable' >
	<tr style='border:1px solid black' bgcolor='#66CC99' > 
    <th>Επώνυμο</th>
	<th>Όνομα</th>
	<th>Ταυτότητα</th>
	<th>Αριθμός Μητρώου</th></tr>
	<tr>
    <td><input name="eponimo" type="text" size='20' value='<?php echo $eponimo; ?>' ></td>
    <td><input name="onoma" type="text" size='20' value='<?php echo $onoma; ?>' ></td>
	<td><input name="idnumx" type="text" size='20' value='<?php echo $idnum; ?>' ></td>
	<td><input name="mitroo" type="text" size='6' value='<?php echo $mitroo; ?>' autofocus ></td>
   </tr>
   </table>
   <br><br>
   <input type="submit" name="submit2" value="ΥΠΟΒΟΛΗ ΣΤΟΙΧΕΙΩΝ" >
   </form> 
   <?php
}
?>
<br /><br />
<td><a  href=<?php echo $menu;?> style="color:blue "><button>ΕΠΙΣΤΡΟΦΗ</button></a></td>
</body>
</html>