<?php 

include("config.php");

 

$cdate=dtformat($_POST[cdate]);
$cdate2=dtformat($_POST[cdate2]);
 $user_ip = getUserIP();
 
 
$timestamp1 = strtotime($cdate);
$timestamp2 = strtotime($cdate2);

// Difference in days
$leave_days = ceil(abs($timestamp2 - $timestamp1) / (60 * 60 * 24));
 
$leave_days=$leave_days+1;
 
 mysql_query("update hr_leave set cdate='$cdate', cdate2='$cdate2', commentx='$_POST[commentx]',leave_days='$leave_days'  where id='$_POST[id]' limit 1");
	
	
 
	

header("location:hr_leave.php");
?>