<?php
session_start();
?>
<!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" />
<title>ΑΠΟΣΤΟΛΗ ΜΥΝΗΜΑΤΩΝ</title>
</head>

<body>
<?php
require "dbconnect.php";
$sms=$_SESSION['sms1'];

    if (isset($_POST['select'])){
	$t=$_POST['taksi'];
	$sms=$_POST['sms'];
    echo $t;  
	$sql = mysqli_query($con,"SELECT kmathiti FROM allstudentinfo WHERE tmima LIKE '$t%' " );
	$c=mysqli_num_rows($sql);
	echo "Θα σταλούν ".$c." μηνύματα";
	$i=1;
	while ($row = mysqli_fetch_array($sql)) 
    {
	if ($row['kmathiti'] <> "") {$tsms[$i]=$row['kmathiti'];}
   	$i++;
	
    }
		
	$_SESSION['kmathiti']=$tsms;
	$_SESSION['sms1']=trim($sms);
	
	include "smssecret.php";     
	}
		
?>	
</body>
</html>