<?php
date_default_timezone_set("Europe/Athens");
include "dbconnect.php";
if (isset($_POST['diataktiko3']))
{
	$dn=$_POST['dn'];
	//$rn=$_POST['rn'];
	$ddone=$_POST['ddone'];print_r($ddone);
	$ergodone=$_POST['jdone'];//array
	$ergo=$_POST['ergo'];//array
	$techn=$_POST['tn'];
	//$new=$_POST['new'];
	
		$i=0;
		foreach ($ergo as $erg)
		{
		  if( trim($erg) <> '' )
			{
				$item=$i+1;
			$q="update diadetail SET jobdone='$ergodone[$i]',techn='$techn[$i]',datedone='$ddone[$i]' where dnum='$dn' and item='$item'";
		
			if (!mysqli_query($con, $q)) 
			{
				echo "Error: " . $q . "<br>" . mysqli_error($con);
			}
			$i++;
		  }
		}
header("Location: diataktiko1.php");
}