<?php
	include "../koneksi.php";
	$data = mysqli_query ($koneksi, " select 
											po_tbl.PO_ID,
											po_tbl.No_PO,
											po_tbl.CustomerID,
											po_tbl.TanggalPO,
											customer.CustomerID,
											customer.CustomerName,
											customer.Alamat,
											customer.CustomerNo
									  from 
									  po_tbl
									  INNER JOIN customer
									  ON po_tbl.CustomerID=customer.CustomerID
									  where PO_ID = $_POST[id]");
	$row = mysqli_fetch_array ($data);
	
?>
<form role="form" id="form-edit" method="post" action="update.php">
<div class="form-group">
	<label>Nomor PO</label>
	<input type="hidden" name="po_id" value="<?php echo $row['PO_ID'] ; ?>">
	<input class="form-control" id="no_po" name="no_po" value="<?php echo $row['No_PO'] ; ?>">
	<p style="color:red" id="error_edit_no_po"></p>
</div>
<div class="form-group">
	<label>Customer</label>
	<select class="form-control" id="cust_id" name="cust_id">
		<option value="<?php echo $row['CustomerID'] ; ?>" selected><?php echo $row['CustomerNo']; ?> | <?php echo $row['CustomerName']; ?> | <?php echo $row['Alamat']; ?></option>
		<?php 
		$data = mysqli_query ($koneksi, " select 
												CustomerID,
												CustomerNo,
												CustomerName,
												Kota
												from 
												customer 
												order by CustomerID DESC");
		while ($row = mysqli_fetch_array ($data))
		{
			?>
		<option value="<?php echo  $row['CustomerID']; ?>"><?php echo $row['CustomerNo']; ?> | <?php echo $row['CustomerName']; ?> | <?php echo $row['Kota']; ?> </option>
		<?php } ?>
	</select>
	<p style="color:red" id="error_edit_cust_id"></p>
</div>
<?php 
	$data = mysqli_query ($koneksi, " select 
											PO_ID,
											No_PO,
											CustomerID,
											TanggalPO
										from 
										po_tbl 
										where PO_ID = $_POST[id]");
										$row = mysqli_fetch_array ($data); ?>	
<div class="form-group">
	<label>Tanggal PO</label>
	<input class="form-control" id="tgl_po" name="tgl_po" value="<?php echo $row['TanggalPO'] ; ?>">
	<p style="color:red" id="error_edit_tgl_po"></p>
</div>			
</form>
