<?php
include("../../include/db.php");
if(($_POST['action']=="ADD")) 
{
 $from_time=$_POST['from_time'];
 $to_time=$_POST['to_time'];
 $shift_name=$_POST['shift_name'];
 $description=$_POST['description'];
$Insql=mysql_query("insert into shift_creation(from_time,to_time,shift_name,description)values('$from_time','$to_time','$shift_name','$description')");
echo "Added Successfully!!";
}

if(($_POST['action']=="EDIT"))
{
$edit_id = $_POST['edit_id']; 
$from_time=$_POST['from_time'];
$to_time= $_POST['to_time'];
$shift_name=$_POST['shift_name'];
$description=$_POST['description'];
$Insql=mysql_query("update shift_creation set from_time='$from_time',to_time='$to_time',shift_name='$shift_name',description='$description'  where  id='$_POST[edit_id]'");
echo "Updated Successfully!!";
}

if($_POST['action']=="delete")
{ 		 
		$delete2="delete from shift_creation where id='$_POST[id]'";
		mysql_query($delete2);
		echo "<script>alert('Deleted Succesfully')</script>";
		include("shift_entry_list.php");
}
?>