
<?php
	include "../koneksi.php";
	$no = 1;
	$data = mysqli_query ($koneksi, " select 
											customer.CustomerID,
											customer.CustomerName,
											customer.Alamat,
											customer.CustomerNo,
											customer.Sales,
											customer.TOD,
											customer.Kota,
											customer.HO_ID,
											ho_tbl.HO_Customer,
											ho_tbl.No_HO,
											ho_tbl.Alamat_HO
									  from 
									  customer
									  INNER JOIN ho_tbl
									  ON customer.HO_ID=ho_tbl.HO_ID
									  where customerID = $_POST[id]");
	$row = mysqli_fetch_array ($data);
	
?>
<form role="form" id="form-edit" method="post" action="update.php">
	<div class="form-group">
		<label>Nama Customer</label>
		<input type="hidden" name="cust_id" value="<?php echo $row['CustomerID'] ; ?>">
		<input class="form-control" name="nama_cust" value="<?php echo $row['CustomerName'] ; ?>">
		<p style="color:red" id="error_edit_nama_cust"></p>
	</div>
	<div class="form-group">
		<label>Alamat</label>
		<textarea class="form-control" name="alamat" rows="3"><?php echo $row['Alamat'] ; ?></textarea>
		<p style="color:red" id="error_edit_alamat"></p>
	</div>
	<div class="form-group">
		<label>Nomor Customer</label>
		<input class="form-control" name="no_cust" value="<?php echo $row['CustomerNo'] ; ?>">
		<p style="color:red" id="error_edit_no_cust"></p>
	</div>
	<div class="form-group">
		<label>Sales</label>
		<input class="form-control" name="sales" value="<?php echo $row['Sales'] ; ?>">
		<p style="color:red" id="error_edit_sales"></p>
	</div>			
	<div class="form-group">
		<label>TOD</label>
		<input class="form-control" name="tod" value="<?php echo $row['TOD'] ; ?>">
		<p style="color:red" id="error_edit_tod"></p>
	</div>			
	<div class="form-group">
		<label>Kota</label>
		<input class="form-control" name="kota" value="<?php echo $row['Kota'] ; ?>">
		<p style="color:red" id="error_edit_kota"></p>
	</div>			
	<div class="form-group">
		<label>Head Office</label>
		<select class="form-control" id="ho_id" name="ho_id">
			<option value="<?php echo  $row['HO_ID']; ?>" selected> <?php echo $row['HO_Customer'] ; ?></option>
			<?php 
			$data = mysqli_query ($koneksi, " select 
									HO_ID,
									HO_Customer,
									No_HO,
									Alamat_HO
								from 
								ho_tbl 
								order by HO_ID ASC");
			while ($row = mysqli_fetch_array ($data))
			{
			?>
			<option value="<?php echo  $row['HO_ID']; ?>"><?php echo $row['HO_Customer']; ?></option>
			<?php } ?>
		</select>
		<p style="color:red" id="error_ho_id"></p>
	</div>			
	
</form>