<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>
	<script src='lib/moment.min.js'></script>
<script src='lib/jquery.min.js'></script>
<script src='fullcalendar.js'></script>
<script src='locale/fr.js'></script>
<script src="lib/jquery.redirect.js"></script>
	<script type="text/javascript">   
function Redirect() 
{  
	
//alert ('redirect');
//$.redirect('default.php', {'dnumdevis': document.getElementById("dnumdevis").value , 'didxcli': document.getElementById("didxcli").value });
var url = "default.php";    
$(location).attr('href',url);
	
} 
//document.write("You will be redirected to a new page in 5 seconds"); 
setTimeout('Redirect()', 400);   
        
</script>
	
	<style>
	
.attente{
	width:110px;
	height:110px;
	position:absolute;
	left:50%;
	top:50%;
	margin:-75px 0 0 -135px;
}
	</style>
	<img class="attente" src="spinner.gif">
    
	<?php 
   
    
 $myboxes0 = $_POST['Tpass'];
 $myboxes1 = $_POST['IDpass'];  
 $myboxes2 = $_POST['Spass'];
 $myboxes3 = $_POST['Epass'];
 $myboxes4 = $_POST['Lpass']; 
 $myboxes5 = $_POST['Dpass'];
 $myboxes6 = $_POST['Cpass'];  
 $myboxes7 = $_POST['Ppass']; 
// $myboxes8 = $_POST['Wpass'];  

  $i = count($myboxes0);
   // echo("<br>You have $i box(es): <br>");
    for($j = 0; $j < $i; $j++)
    {
     
         echo($myboxes0[$j] . " ID ".$myboxes1[$j] ."  ".$myboxes2[$j] ." ".$myboxes3[$j] ."<br>");
         echo($myboxes4[$j] . " ".$myboxes5[$j] ."  ".$myboxes6[$j] ." ".$myboxes7[$j] ." ".$myboxes8[$j] ."------<br><br><hr>");
    }
     
     // on se connecte à notre base pour planning

$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "calendrier";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

    $i = count($myboxes0);
   // echo("<br>You have $i box(es): <br>");
    for($j = 0; $j < $i; $j++)
    {
    	$sql = "UPDATE `planning` SET Debut='".$myboxes2[$j]."', Fin= '".$myboxes3[$j]."', Description='".$myboxes5[$j]."' WHERE  Idx=".$myboxes1[$j]."  ";
 print "<br>".$sql;	
	 
$result = $conn->query($sql);
          }
        
   $conn->close();  
    
    
    
?>
	

<body>
</body>
</html>