<?php
error_reporting(E_ALL); //menampilkan error
 

//cek apakah sudah ada data dari post make
if(isset($_POST['make']))
{
	//merubah huruf menjadi kecil, agar sesuai dengan array di atas
	//$model = strtolower($_POST['make']);
	$model = $_POST['make'];
	
	//menampilkan data untuk combobox yang kedua, berdasarkan combobox pertama yang dipilih
	//dan data untuk combobox kedua dari array diatas.
	//foreach($$model as $mo){ echo '<option value="'.$mo.'">'.$mo.'</option>'; }
	
			
			include "../../../koneksi.php";
				   
                 				       $tampil2=mysql_query("SELECT * FROM pemohon where id_pemohon='$model'  ");  
					                  
				   				while($p=mysql_fetch_array($tampil2))
											{
			                  
							  echo "<div class='control-group' >
							 <label for='Register[Username]'>Alamat Rumah </label>
							<input type='text' cols='42' rows='4' name='alamat_pemohon' id='RegisterUsername' value ='$p[alamat_pemohon]' disabled />
								</div>";
						echo "<div class='control-group' >
							 <label for='Register[Username]'>Nomor Telephone</label>
							<input type='text' name='alamat_pemohon' id='RegisterUsername' value ='$p[nomor_tlp]' disabled />
								</div>";
					 echo "<div class='control-group' >
							 <label for='Register[Username]'>Tanggal Pengajuan</label>
							<input type='text' name='alamat_pemohon' id='RegisterUsername' value ='$p[tanggal]' disabled />
								</div>";
							  
							  
											}
											echo "</select>
				<div class='cleaner_h10'></div>
					
				
							<fieldset id='UserDataFields'>
            <legend>Pilih Nilai Peserta Berdasarkan Kriteria</legend>";
			
				  $tampil=mysql_query("SELECT * FROM kriteria");
				    $i=1;
					$par =1;
				  while($w=mysql_fetch_array($tampil))
					{
					$id_kriteria=$w['id_kriteria'];
					echo "<div class='control-group'>";
                   echo " <label for='Register[Sex]'> $w[nama_kriteria] </label>";
				       $tampil2=mysql_query("SELECT * FROM nilai where id_pemohon='$model' and id_kriteria='$w[id_kriteria]'");  
					//echo 'Kode Produk : <select name="prdId" onchange="changeValue(this.value)">';                    
                   echo "<select id='makes2' name ='xsub[]' >";
				   				$p=mysql_fetch_array($tampil2);
											if (!empty($p))
											{
										
							$tampild=mysql_query("SELECT * FROM sub_kriteria where id_sub='$p[id_sub]'");
								while($wd=mysql_fetch_array($tampild))
											{
											echo "<option value='$wd[id_sub]'>$wd[nama_sub]</option>";
											$tampild2=mysql_query("SELECT * FROM sub_kriteria where id_kriteria='$id_kriteria'");
											while($wd2=mysql_fetch_array($tampild2)){
											echo "<option value='$wd2[id_sub]'>$wd2[nama_sub]</option>";
											}}}
											else
											{
											echo "<option value='belum pilih'>Pilih Salah Satu</option>";
											$tampild2=mysql_query("SELECT * FROM sub_kriteria where id_kriteria='$id_kriteria'");
											while($wd2=mysql_fetch_array($tampild2)){
											echo "<option value='$wd2[id_sub]'>$wd2[nama_sub]</option>";
											}
											}
											
											
											
											echo "</select>";
											
											?>
					
<?php										
				echo "<div class='cleaner_h10'></div>";
				echo "</div>";
				$par = $par+1;
				//$a[$i]="$w[nama_kriteria]";
				$i=$i+1;
				}
				 echo "</select> ";
      
		
			
					
	
}
?>