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


if(($_POST['action']=="EDIT"))
{
$edit_id = $_POST['edit_id']; 
$mach_type=$_POST['mach_type'];
$machine_no= $_POST['machine_no'];
$description=$_POST['description'];
 $system_no=$_POST['system_no'];
$Insql=mysql_query("update machine_creation set mach_type='$mach_type',machine_no='$machine_no',description='$description',system_no='$system_no'  where  id='$_POST[edit_id]'");
echo "Updated Successfully!!";
}


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


?>