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

$outlet_code 	= $conn->real_escape_string($_POST['outlet_code']);
$outlet_name 	= $conn->real_escape_string($_POST['outlet_name']);
$outlet_addr 	= $conn->real_escape_string($_POST['outlet_addr']);
$outlet_phone 	= $conn->real_escape_string($_POST['outlet_phone']);
$act 		= $_POST['act'];
$autoid 	= $_POST['autoid'];

if($act=="add"){
	$sql = "INSERT INTO mst_outlet (outlet_code,outlet_name,outlet_addr,outlet_phone) values ('$outlet_code','$outlet_name','$outlet_addr','$outlet_phone')";
	$conn->query($sql) or die($sql);
}

if($act=="edit"){
	$sql = "UPDATE  mst_outlet set 
				outlet_name = '$outlet_name', 
				outlet_addr = '$outlet_addr',
				outlet_phone = '$outlet_phone' 
				WHERE outlet_autoid = '$autoid'";
	$conn->query($sql) or die($sql);
	}
	
if($act=="delete"){
	$sql = "DELETE FROM mst_outlet WHERE outlet_autoid = '$autoid'";
	$conn->query($sql) or die($sql);
	}
	

header('Location:index');
?>