<?php
include('../headertop.php');
include('../db.php');
//include('../datepicker.php');

$disp = '';
$pagetitle = 'Edit Cost Estimations';

date_default_timezone_set('Asia/Kolkata');

if(!isset($_REQUEST['estimate']))
{
echo '<meta http-equiv="refresh" content="0;URL=estimates.php">';
exit;
}

$estimate = $_POST['estimate'];
$project = 1;

foreach($estimate as $k=>$v)
{
$q[] = "update estimates set estimate='$v' where id='$k'";
}

mysqli_autocommit($dbcon, false);
foreach($q as $query)
{
mysqli_query($dbcon,$query) or die(mysqli_error($dbcon));
}

mysqli_commit($dbcon);
$sm = "Cost Estimate changes saved ";
echo '<meta http-equiv="refresh" content="0;URL=viewestimates.php?project='.$project.'&sm='.$sm.'">';