
<?php
	include "../koneksi.php";
	$data = mysqli_query ($koneksi, " select cost.CostID,
											cost.EkspedisiID,
											ekspedisi.Ekspedisi,
											cost.CustomerID,
											customer.CustomerName,
											Del_Cost,
											Ret_Cost
									  from 
									  cost 
									  INNER JOIN ekspedisi
									  ON cost.EkspedisiID=ekspedisi.EkspedisiID
									  INNER JOIN customer
									  ON cost.CustomerID=customer.CustomerID
									  where CostID = $_POST[id]");
	$row = mysqli_fetch_array ($data);
	
?>
<form role="form" id="form-edit" method="post" action="update.php">
	<div class="form-group">
		<label>Ekspedisi</label>
		<input type="hidden" name="cost_id" value="<?php echo $row['CostID'] ; ?>">
		<select class="form-control" name="ekspedisi" id="ekspedisi">
								<option value="<?php echo $row['EkspedisiID']; ?>" selected><?php echo $row['Ekspedisi']; ?></option>
								<?php 
								$data3 = mysqli_query ($koneksi, " select 
														EkspedisiID,
														Ekspedisi
												  from 
												  ekspedisi 
												  where EkspedisiID!='4' && EkspedisiID!='5'
												  order by EkspedisiID DESC");
								while ($row3 = mysqli_fetch_array ($data3))
								{
								?>
								<option value="<?php echo  $row3['EkspedisiID']; ?>" ><?php echo $row3['Ekspedisi']; ?></option>
								<?php } ?>
							</select>
		<p style="color:red" id="error_edit_ekspedisi"></p>
	</div>
	<div class="form-group">
		<label>Customer</label>
		<select class="form-control" name="customer" id="customer">
								<option value="<?php echo $row['CustomerID']; ?>" selected><?php echo $row['CustomerName']; ?></option>
								<?php 
								$data2 = mysqli_query ($koneksi, " select 
														CustomerID,
														CustomerName
												  from 
												  customer 
												  order by CustomerID DESC");
								while ($row2 = mysqli_fetch_array ($data2))
								{
								?>
								<option value="<?php echo  $row2['CustomerID']; ?>" ><?php echo $row2['CustomerName']; ?></option>
								<?php } ?>
							</select>
		<p style="color:red" id="error_edit_alamat"></p>
	</div>
	<div class="form-group">
		<label>Delivery Cost</label>
		<input class="form-control" name="del_cost" value="<?php echo $row['Del_Cost'] ; ?>">
		<p style="color:red" id="error_edit_del_cost"></p>
	</div>
	<div class="form-group">
		<label>Return Cost</label>
		<input class="form-control" name="ret_cost" value="<?php echo $row['Ret_Cost'] ; ?>">
		<p style="color:red" id="error_edit_ret_cost"></p>
	</div>			
	
</form>