<?php
ob_start();
session_start();
require_once("../conn/conn.php");
//include('../utility/chksession.php');
date_default_timezone_set("Asia/Bangkok");

$id_posub=$_POST['id_posub'];
$id_po=$_POST['id_po'];
$id_item=$_POST['id_item'];
$part_qty=$_POST['part_qty'];
$part_unit=$_POST['part_unit'];
$id_dep=$_POST['id_dep'];
echo $id_posub.$id_po;

//exit;
 $strSQL = "SELECT * FROM pd_item where id_item='$id_item'";
$objQuery = mysqli_query($con,$strSQL);  
$objResult = mysqli_fetch_array($objQuery);

$name_item=$objResult['name_item'];

  
   $sql = "UPDATE pd_posub SET id_item = '$id_item',name_item='$name_item',part_qty = '$part_qty',
   part_unit = '$part_unit',id_dep = '$id_dep'
   WHERE id_posub = '$id_posub'";
	$query = mysqli_query($con,$sql);
        if($query){
            ?>
                <script language="JavaScript" type="text/javascript">
                    <!--
                    alert("บันทึกข้อมูลเรียบร้อย");
                    location.href='../admin/data_posub.php?id_po=<?=$id_po;?>';
                    //-->
                </script>
            <?php
        }else{
            
            echo "Error: " . $sql . "<br>" . mysqli_error($con);

        }
        mysqli_close($con);





?>