<?php session_start(); 
	include('conn.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
	if($_POST['id_category']!=""&&$_POST['name_category']!=""&&$_POST['detail']!=""){
		$sql = "insert into category (id_category,name_category,detail)values 
									('".$_POST['id_category']."', '".$_POST['name_category']."','".$_POST['detail']."');";
		$data = mysql_query($sql);
		
		if($data){	
			echo "<script>
				alert('บันทึกข้อมูลเรียบร้อยแล้ว');
				</script>";
			echo "<meta http-equiv=\"refresh\" content=\"0;URL=category.php\" />";
		}else{
			echo "เกิดข้อผิดพลาด";
		}
	}else{
		echo"<script>
		alert('ข้อมูลยังไม่ครบถ้วน');
		history.back();
		</script>";
	}
?>
</body>
</html>