<?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>

</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>
<h4>ΕΠΙΛΟΓΗ ΔΡΑΣΗΣ ΓΙΑ ΚΑΤΑΧΩΡΗΣΗ Δ.Δ.Κ </h4>
<?php 
require("dbconnect.php");

$usr=$_SESSION['usr'];
$sql = mysqli_query($con,"SELECT  code,portfolio FROM ddkportfolio where  mark > 0");

$fhtml = '<form method="post"> Δράση Portfolio:
<select name="pdrasi" >';

while($row = mysqli_fetch_array($sql) ) 
	  {
        $fhtml.='  
		  $d=$row["code"].". ".$row["portfolio"];echo $d;
		  $x=$row["code"];
		  ?>
		  <option value="<?php echo $x;?>" > <?php echo $d; ?> </option>
		  <?php';
      }
   
    $fhtml.=' </select>

<input type="submit" name="submit1" value="Επιλογή Δράσης" >
</form>';

echo $fhtml;    
    

if (isset($_POST['pdrasi']))
{
echo "<br>"."<br>";
$pdrasi=$_POST['pdrasi'];
$sql = mysqli_query($con,"SELECT  portfolio FROM ddkportfolio where  code='$pdrasi'");
$row = mysqli_fetch_array($sql);
$port=$row['portfolio'];
$sql = "SELECT mitroo,tmima,eponimo,onoma  FROM allstudentinfo ORDER BY tmima,eponimo,onoma ";
$result = mysqli_query($con,$sql);

?>
<form  method="post" name ="epilogi" action = "ddkstulist.php"> 
<div style="overflow:scroll; border:1px solid black;background:#F5F9F0;width:520px; height: 650px">
<?php
echo $port;
echo "<table style='width:500px' class='myTable' >
<tr style='border:1px solid black' bgcolor='#adcd82'  >
<th>ΜΗΤΡΩΟ</th>
<th>ΤΜΗΜΑ</th>
<th>ΟΝΟΜΑΤΕΠΩΝΥΜΟ</th>
<th></th>
<th>ΕΠΙΛΟΓΗ</th>
</tr>";

$i=1;
while ($row = mysqli_fetch_array($result)) 
  { 
    $am[$i]=$row['mitroo'];
	$tm1[$i]=$row['tmima'];
	$namet[$i]=$row['eponimo']." ".$row['onoma'];;
	echo "<tr>";
	echo "<td>".$am[$i]."</td>";
	echo "<td>".$tm1[$i]."</td>";
	echo "<td>".$namet[$i]."</td>";
	echo "<td>"." "."</td>";
    echo "<td ALIGN=center>"."<input type='checkbox' name='mitr[]' value='$am[$i]'  {$checked} >"."</td>";
	echo "</tr>";
    $i++;
}
echo "</table>";
?>
</div>
<br>
<input type='hidden' name='pdrasi' value='<?php echo $pdrasi; ?>'>
<input type="Submit" name="portdrasi" value="ΤΕΛΟΣ ΕΠΙΛΟΓΗΣ"  >
</form>	
<?php
}
?>	
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>
</body>
</html>