<?php
include("../include/db.php");

if(($_POST['action']=="ADD")) 
{
$operator_name=$_POST['operator_name'];
$labour_type=$_POST['labour_type'];
$department=$_POST['department'];
$operator_type=$_POST['operator_type'];
$create_date=date('Y-m-d');
$Insql=mysql_query("insert into operator_creation(operator_name,labour_type,operator_type,create_date,department)values('$operator_name','$labour_type','$operator_type','$create_date','$department')");
echo "Added Successfully!!";
}
/********************************** UPDATE QUERY ***************************************/
if(($_POST['action']=="EDIT"))
{
$edit_id = $_POST['edit_id']; 
$labour_type=$_POST['labour_type'];
$operator_name=ucfirst($_POST['operator_name']);
$department=$_POST['department'];
$operator_type=$_POST['operator_type'];
$create_date=date('Y-m-d');
$Insql=mysql_query("update operator_creation set operator_name='$operator_name',labour_type='$labour_type',department='$department',operator_type='$operator_type',create_date='$create_date' where  id='$_POST[edit_id]'");
echo "Updated Successfully!!";
}
/********************************************DELETE*****************************************************************/
if($_POST['action']=="delete_operator")
{ 	
		   $delete2="delete from operator_creation where id='$_POST[id]'";
			mysql_query($delete2);
			echo "<script>alert('Deleted Succesfully')</script>";
			include("operator_entry_list.php");
}
?>