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

$disp = '';
$pagetitle = 'Edit/Delete Work Type';

date_default_timezone_set('Asia/Kolkata');

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

$work_type = $_POST['work_type'];
//print_r($work_type);

foreach($work_type as $k=>$v)
{
$q[] = "update work_type set work_type='$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 = "Work category changes saved ";
echo '<meta http-equiv="refresh" content="0;URL=addworktype.php?sm='.$sm.'">';