<?php 
include "scrinit.php";
include $menu;
?>
<!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" />
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:1px;font-size:10pt; }
<p style="font-size:10px;"></p>
</style>
<title>SMS Πρώτης Περιόδου</title>

<?php 

require("dbconnect.php");
$usr=$_SESSION['usr'];

$sql = $dbcon->prepare("SELECT * from loizos where snd=0" );
$sql->execute();
$c=$sql->rowCount();
echo $c;
if ($c > 0)  
{  

echo "<BR>"."<b>"."ΚΑΤΑΛΟΓΟΣ ΓΙΑ ΑΠΟΣΤΟΛΗ ΜΗΝΥΜΑΤΩΝ "."</b>";
?>	
<form method="POST"  >
<?php
echo "<table class='myTable' >
<tr style='border:1px solid black' bgcolor='#d6ff73'  >
<th>Α/Α</th>
<th>ΟΝΟΜΑ</th>
<th>ΤΗΛΕΦΩΝΟ</th>
<th>ΜΗΝΥΜΑ</th>
</tr>";


$cc=0;
$bname=" Αποστολη SMS ";
while($row=$sql->fetch(PDO::FETCH_ASSOC)) 
{
	$nam[$cc]=$row['name'];
	$kinito[$cc]=trim($row['til']);
	$mesg[$cc]=$row['mes'];
	echo "<td>". $cc . "</td>";
	echo "<td>". $nam[$cc]."</td>";
	echo "<td>". $mesg[$cc]."</td>";
	$x=$kinito[$cc]."/".$nam[$cc]."/".$mesg[$cc];
	echo "<td>". "<input type='text' name='telef[]' value='$kinito[$cc]' size='10'>"."<td>";
	echo "<td>". "<input type='checkbox' name='tsms[]' value='$x'  checked>" ."</td>";	
	echo "</tr>"; 
    $cc++;
}
echo "</table>";

?>
<br>
<input type="submit" value="<?php echo $bname ; ?>" name="submit">
</form>


<?php

}
else
{
   echo "Δεν υπάρχουν εγγραφές ";
}


if (isset($_POST['submit'])) 
{
	
	$tm=array();
	$i=0;
	$tel=$_POST['tsms'];
	if (count($tel) > 0)
	{
		foreach ($tel as $t)
		{
		   $ar=explode("/",$t);
		   $tm[$i]=$ar[0];
		   $mesg[$i]=$ar[2];
		   $nam[$i]=$ar[1];
		   $i++;
		}	   
			
		
		$_SESSION['tel']=$tm;
		$_SESSION['onoma']=$nam;
		$_SESSION['mes']=$mesg;
		include "sendloizos.php";    	
	}
}
?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>
</body>
</html>