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

$cc_code 	= $conn->real_escape_string($_POST['cc_code']);
$cc_name 	= $conn->real_escape_string($_POST['cc_name']);
$act 		= $_POST['act'];
$autoid 	= $_POST['autoid'];

if($act=="add"){
	$sql = "INSERT INTO $sql_table (cc_code,cc_name) values ('$cc_code','$cc_name')";
	$conn->query($sql) or die($sql);
}

if($act=="edit"){
	$sql = "UPDATE  $sql_table set cc_name = '$cc_name' WHERE cc_autoid = '$autoid'";
	$conn->query($sql) or die($sql);
	}
	
if($act=="delete"){
	$sql = "DELETE FROM $sql_table WHERE cc_autoid = '$autoid'";
	$conn->query($sql) or die($sql);
	}
	

header('Location:index');
?>