<title>Edit Galeri</title>
<?php
	$sql = "SELECT armada_id,armada_nama FROM tbl_armada";
	$getCombo = mysqli_query($koneksi, $sql,$koneksi) or die ('Query Gagal');
?>
<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function() {
		$("#ARID").change(function(){
			$("img#imgLoad").show();
			var armada_id = $(this).val();
			
			$.ajax({
				type: "POST",
				dataType: "html",
				url: "12getArmada.php",
				data: "armada_id="+armada_id,
				success: function(msg){
					if(msg == ''){
						$("select#ARNAMA").html('<option value="">- Pilih -</option>');
						}else{
						$("select#ARNAMA").html(msg);                                                       
					}
					$("img#imgLoad").hide();
				}
			});                    
		});
	});
</script>
<div id="tampil_judul">EDIT GALERI</div>
<div id="batas_padding">
	<form action="?m=busimg_update" method="post" enctype="multipart/form-data">
		<?php
			$gdb = mysqli_query($koneksi, "SELECT * FROM cmas_busimg WHERE busimg_id='$_GET[id]'");
			$gdt = mysqli_fetch_array($gdb);
		?>
		<input name="busimg_id" type="hidden" value="<?php echo $gdt['busimg_id']; ?>">
		
		<div id="wrapgsetting" class="clearfix">
			<div id="gsetting" class="clearfix" >
				<div id="gsettinglabel">Status</div>
				<div id="gsettingedit">
					<select name="busimg_status"> 
						<option value="<?php echo $gdt['busimg_status']; ?>"><?php echo $gdt['busimg_status']; ?></option>
						<option value="Aktif">Aktif</option>
						<option value="Non-Aktif">Non-Aktif</option>
					</select>
				</div>
			</div>
			
			<div id="gsetting" class="clearfix" >
				<div id="gsettinglabel">Nama Armada</div>
				<div id="gsettingedit">
					<select name="armada_id" id="ARID">
						<option value="<?php echo $gdt['armada_id']; ?>"><?php echo $gdt['armada_nama']; ?></option>
						<?php
							while($data = mysqli_fetch_array($getCombo)){
								echo '<option value="'.$data['armada_id'].'">'.$data['armada_nama'].'</option>';
							}
						?>
					</select>
					<select name="armada_nama" id="ARNAMA" style="display:none">
						<option value="<?php echo $gdt['armada_nama']; ?>"><?php echo $gdt['armada_nama']; ?></option>
					</select>
				</div>
			</div>
			
			<div id="gsetting" class="clearfix" >
				<div id="gsettinglabel">Upload Photo</div>
				<div id="gsettingedit">
					<img src="assets/images/galeri/<?php echo $gdt['busimg_image']; ?>"><br>
					<input type="file" name="busimg_image" />
				</div>
			</div>
			<div id="input_text_Submit">
				<input name="Submit" type="submit" value="UPDATE" class="submitbutton"/>
				<a href="?m=busimg_index">
					<input name="Button" type="button" value="BATAL" class="myButton" />
				</a>
			</div>
		</div>
		
	</form>
</div>