
<?php
session_start();
include('dbconnect.php');
//collect the passed id
$id = $_GET['tmimaid'];
//run a query
$sql2 = mysqli_query($con,"SELECT mitroo,eponimo,onoma,kpatera,kmiteras,kinito FROM allstudentinfo 
WHERE tmima = '$id' ORDER BY eponimo,onoma");

//loop through all returned rows

while($row = mysqli_fetch_array($sql2) ) {
    $m=$row['mitroo'];
	$stname=trim($row['eponimo']."  ".$row['onoma']);
	$l=40-mb_strlen($stname);
	$kp=$row['kpatera'];
	$km=$row['kmiteras'];
	$ksms=$kp=$row['kinito'];  
	$dispitem=$m.str_repeat('&nbsp;',5).$stname.str_repeat('&nbsp;',$l)." (τηλ Π:".$kp.", Μ:".$km.", SMS:".$ksms.")";
	
    echo "<option value='$m'>$dispitem</option>";

}