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


$cust_type = $_POST['cust_type'];


$cust_name 		= $conn->real_escape_string($_POST['cust_name']);
$cust_phoneno 	= $conn->real_escape_string($_POST['cust_phoneno']);
$cust_email 	= $conn->real_escape_string($_POST['cust_email']);
$cust_addr 	= $conn->real_escape_string($_POST['cust_addr']);
$cust_pic 	= $conn->real_escape_string($_POST['cust_pic']);


$act = $_POST['act'];
$autoid = $_POST['autoid'];

if($act=="add"){
	$sql = "INSERT INTO mst_customer (cust_name,cust_phoneno,cust_email,cust_addr,cust_pic) 
			VALUES ('$cust_name','$cust_phoneno','$cust_email','$cust_addr','$cust_pic')";
	$conn->query($sql) or die($sql);
	header('Location:index');
	}

if($act=="edit"){
	$sql = "UPDATE mst_customer SET 
					cust_name = '$cust_name', 
					cust_phoneno = '$cust_phoneno',
					cust_email = '$cust_email',
					cust_addr = '$cust_addr',
					cust_pic = '$cust_pic'
				WHERE cust_autoid = '$autoid'";
	$conn->query($sql) or die($sql);
	header('Location:index');

}

?>