<?php
include('config.php');

$pt_autoid 	= $_POST['pt_autoid'];
$pc_code 	= $conn->real_escape_string($_POST['pc_code']);
$pc_name 	= $conn->real_escape_string($_POST['pc_name']);
$act 		= $_POST['act'];
$autoid 	= $_POST['autoid'];

if($act=="add"){
	$sql = "INSERT INTO mst_partclass 
			(pt_autoid,pc_code,pc_name) 
			VALUES
			('$pt_autoid','$pc_code','$pc_name')";
	$conn->query($sql) or die($sql);
	header('Location:new?status=ok');

}

if($act=="edit"){
	$sql = "UPDATE  mst_partclass SET 
			pt_autoid = '$pt_autoid',
			pc_code = '$pc_code',
			pc_name = '$pc_name' 
			WHERE pc_autoid = '$autoid'";
	$conn->query($sql) or die($sql);
header('Location:index');

	}
	
if($act=="delete"){
	$sql = "DELETE FROM mst_partclass WHERE pc_autoid = '$autoid'";
	$conn->query($sql) or die($sql);
header('Location:index');

	}
	

?>