<?php
session_start();
include 'myfunctions.php';

$tblName="";
$IDc=0;
   foreach($_POST as $key => $value):
		$frmValues[$key]=$value;
		if ($key=='tblName'){$tblName=$value;}
		if ($key=='IDc'){$IDc=$value;}
		if ($key=='PageName'){$PageName=$value;}
		if ($key=='IDcField'){$IDcField=$value;}
   endforeach;
 
  $sql = "DELETE FROM ".$tblName." WHERE ".$IDcField."=".$IDc;	
	if ($conn->query($sql) === TRUE) {
	   #  echo "Record deleted successfully";	
	} else {
	    # echo "Error deleting record: " . $conn->error;
	}	 
 
setcookie($IDcField, '0' ); // +(10)=10 sec  : 86400 = 1 day
# Close connection
$conn->close();
echo '.'; 
?>
 
 <script language="JavaScript" type="text/JavaScript">
var PageName='<?php echo $PageName ?>';
 // alert ('PageName' + PageName  );
if (PageName=="Pelates_Kiniseis_Add.php" ||
    PageName=="Pelates_Service_Add.php" || 
	PageName=="tameio_add.php" || 
	PageName=="notes_add.php" ||
    PageName=="TameioApothematikoAdd.php") {
	  //  window.history.go(-2);
	  //location.reload();
	  window.close();	  
	  window.opener.location.reload();
	  
	 // window.opener.close();
	 // window.reload();
	  
	} else {
	  window.history.go(-2);
	  location.reload(); 
	  
	  //window.history.back();
	  //location.reload(); 	
	  }
	  
</script>
 
  
