Salam programmer
Saya mau bertanya tentang penggunaan multiple form
Jadi kasusnya begini :
Pada halaman tambah Risalah terdapat beberapa fitur yaitu nama, kode, judul, tgl dll
Dan satu fitur lagi yaitu Tambah Debitur, kan jumlah debitur tidak selalu satu bagaimana cara memberi fitur tersebut?
Saya menggunakan form didalam form dan ternyata setelah submit form pertama trus disubmit form kedua data dari form pertama tidak muncul ketika akan dimasukkan kedatabase
<form action='' method='post' name='frm-tambah'> //FORM PERTAMAA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<table>
    <tr>
        <td>Nomor Risalah</td><td> : </td>
        <td><input type='text' name='kd_risalah' id='kb' value='<?php echo $valKB; ?>'></td>
    </tr>
     <tr>
        <td>Pemohon Risalah</td><td> : </td>
        <td><input  type='text' name='no_surat'></td>
    </tr>
     <tr>
        <td>Penanggung jawab</td><td> : </td>
        <td><?php
        echo "<select name='pl'>";
		$tampil=mysql_query("SELECT * FROM pl ORDER BY id");
echo "<option value='' selected>- Pilih Salah Satu -</option>";

while($w=mysql_fetch_array($tampil))
{
    echo "<option value=$w[nama]>$w[nama]</option>";        
}
 echo "</select>";
         ?>
         </td>


    </tr>
    <tr>
        <td>Tanggal Surat</td><td> : </td>
        <td><input   type='text' name='tahun' size='10' value='<?php echo $arr['tgl_masuk']; ?>'></td>
    </tr>
    <tr>
        <td>Pemohon</td><td> : </td>
        <td><input type='text' name='pemohon' value="<?php echo $arr['pemohon']; ?>"></td>
    </tr>
    <tr>
        <td>Limit Lelang</td><td> : </td>
        <td><input  type='text' name='lmt' size='10' value="<?php echo $arr['lmt']; ?>"></td>
    </tr>
    <tr>
        <td>Baru/Ulang </td><td> : </td>
        <td><select name='lmt'>
        <option value='B'>Baru</option>
        <option value='U'>Ulang</option>
        </select>
        </td>

    </tr>
 <form action="#" method="post"> //FORM KEDUA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    <tr>
    <td>Input Jumlah Debitur</td><td> : </td>
        <td>
        <select name="jmldbt<?php echo $jumlah; ?>"><br>
        <option value='1'>1</option>
        <option value='2'>2</option>
        <option value='3'>3</option>
        <option value='4'>4</option>
        <option value='5'>5</option>
        </select>
</td>
        <td><input type="submit" name="tambahdt" value="+" class="btn btn-info"></td>
    </form>
    </tr>
    <?php
if($_POST['jmldbt'])
{
?>

<?php
$jumlah = $_POST['jmldbt'];
 
for($a=1;$a<=$jumlah;$a++)
{
?>
    <tr>
        <td>Debitur Ke - <?php echo $a; ?></td><td> : </td>

 
        <td><input type="text" name="nmdbt<?php echo $jumlah; ?>"><br></td>
    </tr>
<?php
}
?>


<?php
}
?> 
    <tr>
        <td>Lokasi Risalah</td><td> : </td>
        <td><select name='lemari'style="width: 140px;">
		<option value=''>--Lemari--</option>
		<option value='Lemari 1984'>Lemari 1984</option>
		<option value='Lemari 1985'>Lemari 1985</option>
		<option value='Lemari 1986'>Lemari 1986</option>
		<option value='Lemari 1987'>Lemari 1987</option>
		<option value='Lemari 1988'>Lemari 1988</option>
		<option value='Lemari 1989'>Lemari 1989</option>
        <option value='Lemari 1990'>Lemari 1990</option>
        <option value='Lemari 1991'>Lemari 1991</option>
        <option value='Lemari 1992'>Lemari 1992</option>
        <option value='Lemari 1993'>Lemari 1993</option>
        <option value='Lemari 1994'>Lemari 1994</option>
        <option value='Lemari 1995'>Lemari 1995</option>
        <option value='Lemari 1996'>Lemari 1996</option>
        <option value='Lemari 1997'>Lemari 1997</option>
        <option value='Lemari 1998'>Lemari 1998</option>
        <option value='Lemari 1999'>Lemari 1999</option>
        <option value='Lemari 2000'>Lemari 2000</option>
        <option value='Lemari 2001'>Lemari 2001</option>
        <option value='Lemari 2002'>Lemari 2002</option>
        <option value='Lemari 2003'>Lemari 2003</option>
        <option value='Lemari 2004'>Lemari 2004</option>
        <option value='Lemari 2005'>Lemari 2005</option>
        <option value='Lemari 2006'>Lemari 2006</option>
        <option value='Lemari 2007'>Lemari 2007</option>
        <option value='Lemari 2008'>Lemari 2008</option>
        <option value='Lemari 2009'>Lemari 2009</option>
        <option value='Lemari 2010'>Lemari 2010</option>
        <option value='Lemari 2011'>Lemari 2011</option>
        <option value='Lemari 2012'>Lemari 2012</option>
        <option value='Lemari 2013'>Lemari 2013</option>
        <option value='Lemari 2014'>Lemari 2014</option>
        <option value='Lemari 2015'>Lemari 2015</option>
        <option value='Lemari 2016'>Lemari 2016</option>
        <option value='Lemari 2017'>Lemari 2017</option>
        <option value='Lemari 2018'>Lemari 2018</option>

	    </select>

        <select name='indeks' style="width: 100px;">
		<option value=''>--Indeks--</option>
		<option value='Indeks A'>Indeks A</option>
		<option value='Indeks B'>Indeks B</option>
		<option value='Indeks C'>Indeks C</option>
		<option value='Indeks D'>Indeks D</option>
		<option value='Indeks E'>Indeks E</option>

	    </select>
	    <select name='rak' style="width: 100px;">
		<option value=''>--Rak--</option>
		<option value='Rak 1'>Rak 1</option>
		<option value='Rak 2'>Rak 2</option>
		<option value='Rak 3'>Rak 3</option>
		<option value='Rak 4'>Rak 4</option>
		<option value='Rak 5'>Rak 5</option>
		<option value='Rak 6'>Rak 6</option>
	
	    </select>

	    </td>
        
    </tr>
    
    <tr><td colspan='3'><input class="btn btn-info" type='submit' value='Tambah' name='tambah'></td></tr>
</table>
</form>
Silahkan login untuk menjawab!

Combobox

Tri · Jun 2, 2018
Selamat sore, saya membuat tiga tabel karyawan, manager, dan direktur. Saat dipilih combobox jabatan (karyawan, manager,direktur), maka akan otomatis dibawahnya muncul combobox nama dari jabatan yang dipilih. Bagaimana cara membuatnya ? Mohon bantuannya
Silahkan login untuk menjawab!
Selamat sore agan2, mohon pencerahannya.
Saya membuat membuat perhitungan rata2 pada tabel array, pada row pertama berhasil menghitung namun pada row berikutnya gagal. mohon bantuannya, terima kasih agan2...

https://img1.uploadhouse.com/fileuploads/26092/260925516e556090107abe660965bdcf9160283e.jpg

<script language="javascript" >
function OperasiPerhitungan(){
A1 = document.getElementById("angka1").value;
A2 = document.getElementById("angka2").value;
A3 = (parseFloat(A1) + parseFloat(A2))/2;
document.getElementById("hasil").value =A3;
}
</script>
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
		<div class="row">
			<div class="col-lg-12">
				<center><h3 class="page-header">EDIT NILAI</h3></center>
			</div>
		</div><!--/.row-->	
        <?php include ('koneksi.php');
        $nip=$_SESSION['$nip'];
        ?>
<div class="row">
			<div class="col-lg-12">
				<div class="panel panel-danger">
					<div class="panel-body">
					<form method="POST" action="input_nilai_edit_proses.php">
						<table id="example" class="" cellspacing="0" width="100%">
						        <thead>
						            <tr class="alert warning">
						            	<th>No</th>
						            	<th></th>
						            	<th>NIS</th>
						            	<th>Siswa</th>
						            	<th>UH 1</th>
						            	<th>UH 2</th>
								<th>RERATA</th>
						            </tr>
						        </thead>						
						        <tbody>
								<?php
								include('koneksi.php');
								$id_mapel = $_GET['id_mapel'];
								$query = mysql_query("SELECT siswa.nama,nilai.id_mapel, nilai.id_nilai, 
								nilai.nis, nilai.uh1,nilai.uh2
								FROM siswa, nilai WHERE siswa.nis=nilai.nis AND nilai.id_mapel= '$id_mapel'");
								 $no = 0;	//membuat variabel $no untuk membuat nomor urut
								while($data = mysql_fetch_array($query)){
								 $no++;
								 $id_nilai = $data['id_nilai'];
								$id_mapel = $data['id_mapel'];
								$rerata = $data['rerata'];
								?>
				<tr>
				<td><?php echo $no; ?></td>
				<td><input type="hidden" name="id_nilai[]" value="<?php echo $data['id_nilai']; ?>"></td>
				<td><?php echo $data['nis']; ?></td>
				<td><?php echo $data['nama']; ?></td>
				<td><input type="number" name="uh1[]" id="angka1" onchange="OperasiPerhitungan();" value="0" style="width:50px"></td>
				<td><input type="number" name="uh2[]" id="angka2" onchange="OperasiPerhitungan();" value="0" style="width:50px"></td>
				<td><input type="number" name="rerata[]" id="hasil" disabled="disabled" value="0" style="width:80px"></td>
				</tr>
						            <?php } ?>
						    	</tbody>
						    </table>
							<div class='navbar-form pull-left'>
							<button type="submit" name="tambah" class="btn btn-danger">Simpan</button>
							</div>
						</form> 
Silahkan login untuk menjawab!
Mohon bantuannya para master sekalian..
Saya membuat script yg mengruangi tanggal, contohnya jika tanggal sekarang - tanggal mulai hasilnya sama dengan atau kurang dari 3 hari maka waktunya on time, jika lebih besar dari 3 maka waktunya over time.

pertanyaannya
pas hasilnya kurang dari atau sama dengan 3 waktunya over time, pokoknya jika hasilnya positif waktunya pasti over time. giliran hasilnya negatif baru waktunya on time.
ini script yg saya buat
$tanggal  = strtotime('2018-05-22');
$sekarang    = time(); // Waktu sekarang
$diff   = $sekarang - $tanggal ;
echo 'Waktu pengerjaan yaitu ' . floor($diff / (60 * 60 * 24)).' Hari'.'<br><br>';
if ($diff <= 3){
	echo ' Ontime';
}else{
	echo ' Over time';
mohon bantuannya jika ada kesalahan.
Terima kasih
Silahkan login untuk menjawab!
Mohon bantuannya para master sekalian..
Saya ingin membuat script dimana jika kita memilih salah satu value pada combobox maka pada combobox yang lainnya menampilkan data dari database.
contohnya dalam combobox1 terdapat 3 value yaitu 1,2,3. ketika kita memilih 1 maka kita akan menampilkan data pada combobox2 dari tabel 1.
mohon bantuannya.
Terima kasih
Silahkan login untuk menjawab!
saya mau menampilkan data dari tabel jasa, berdasrkan combobox yang ada..saya make method post..disini ada 5 combobox, sebelum dipilih combobox yg awa, combobox selanjutnya nonaktif.. nah jd klo saya cuma pilih beberapa combobox untuk menampilkan data, dia muncul error karena combobox yg nonaktif itu saya panggil method post nya...harusnya seprti apa ya codingannya ??
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
  <!-- BASICS -->
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Price List</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" type="text/css" href="css/isotope.css" media="screen" />
  <link rel="stylesheet" href="js/fancybox/jquery.fancybox.css" type="text/css" media="screen" />
  <link rel="stylesheet" href="css/bootstrap.css">
  <link rel="stylesheet" href="css/bootstrap-theme.css">
  <link rel="stylesheet" href="css/style.css">
  <!-- skin -->
  <link rel="stylesheet" href="skin/default.css">
  <!-- =======================================================
    Theme Name: Amoeba
    Theme URL: https://bootstrapmade.com/free-one-page-bootstrap-template-amoeba/
    Author: BootstrapMade
    Author URL: https://bootstrapmade.com
	 class="navbar-brand"
  ======================================================= -->
</head>

<body>
  <section id="header" class="appear"></section>
  <div class="navbar navbar-fixed-top" role="navigation" data-0="line-height:100px; height:100px; background-color:rgba(0,0,0,0.3);" data-300="line-height:60px; height:60px; background-color:rgba(0,0,0,1);">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
						<span class="fa fa-bars color-white"></span>
					</button>
        <h1><a href="pricelist.php" data-0="line-height:90px;" data-300="line-height:50px;"><i class="fa fa-flask fa-2x mar-bot20"></i>  TABELKU
					</a></h1>
      </div>
      <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav" data-0="margin-top:20px;" data-300="margin-top:5px;"> 
          <!--<li class="active"><a href="index.html">Home</a></li>
          <li><a href="#section-about">About</a></li>
          <li><a href="#section-works">Portfolio</a></li>
          <li><a href="#section-contact">Contact</a></li>-->
        </ul>
      </div>
      <!--/.navbar-collapse -->
    </div>
  </div>

  <section class="featured" color="#000000">
    <div class="container" color="#000000">
      <div class="row mar-bot40">
        <div class="col-md-100 col-md-offset-0">

          <div class="align-center" margin-left="10px" >
            <!--<i class="fa fa-flask fa-5x mar-bot20"></i>
            <h2 class="slogan">TABELKU</h2>-->
            <p>
              
			  
			  <html>
<?php
//        koneksi ke database
        //mysql_connect('localhost', 'username', 'password');
        //mysql_select_db('belajar');
		include "config.php";
        ?>
        <form method="post">
            
            <!--sbu-->
			SBU :
            <select class='Menu' style="width:200px" id="sbu" name="sbu">
                <option value=''>Please Select</option>
                <?php
                $query = mysqli_query($db, "SELECT * FROM sbu ORDER BY nm_sbu");
                while ($row = mysqli_fetch_array($query)) {
                ?>
                    <option value="<?php echo $row['kd_sbu']; ?>">
                        <?php echo $row['nm_sbu']; ?>
                    </option>
                <?php
                }
                ?>
            </select>
            
            <!--bid-->
			BIDANG :
            <select class='Menu' style="width:200px" id="bid" name="bid">
                <option value=''>Please Select</option>
                <?php
                $query = mysqli_query($db, "SELECT * FROM bid
                                    INNER JOIN sbu ON bid.kd_sbu = sbu.kd_sbu where bid.operasional = 1 ORDER BY nm_bid");
                while ($row = mysqli_fetch_array($query)) {
                ?>
                    <option id="kota" class="<?php echo $row['kd_sbu']; ?>" value="<?php echo $row['kd_bid']; ?>">
                        <?php echo $row['nm_bid']; ?>
                    </option>
                <?php
                }
                ?>
            </select>
 
            <!--subbid-->
			SUB BIDANG :
            <select class='Menu' style="width:200px" id="subbid" name="subbid">
                <option value=''>Please Select</option>
                <?php
                $query = mysqli_query($db, "SELECT * FROM subbid
                                        INNER JOIN bid ON subbid.kd_bid = bid.kd_bid ORDER BY nm_subbid");
                while ($row = mysqli_fetch_array($query)) {
                ?>
                    <option id="subbid" class="<?php echo $row['kd_bid']; ?>" value="<?php echo $row['kd_subbid']; ?>">
                        <?php echo $row['nm_subbid']; ?>
                    </option>
                <?php
                }
                ?>
            </select>
 
            <!--gkom-->
			GRUP KOMODITI :
            <select class='Menu' style="width:200px" id="gkom" name="gkom">
                <option value=''>Please Select</option>
                <?php
                $query = mysqli_query($db, "SELECT * FROM gkom
                                        INNER JOIN subbid ON gkom.kd_subbid = subbid.kd_subbid ORDER BY nm_gkom");
                while ($row = mysqli_fetch_array($query)) {
                ?>
                    <option id="gkom" class="<?php echo $row['kd_subbid']; ?>" value="<?php echo $row['kd_gkom']; ?>">
                        <?php echo $row['nm_gkom']; ?>
                    </option>
                <?php
                }
                ?>
            </select>
 
            <!--kom-->
			KOMODITI :
            <select class='Menu' style="width:200px" id="kom" name="kom">
                <option value=''>Please Select</option>
                <?php
                $query = mysqli_query($db, "SELECT * FROM komoditi
                                        INNER JOIN gkom ON komoditi.kd_gkom = gkom.kd_gkom ORDER BY nm_komoditi_ind");
                while ($row = mysqli_fetch_array($query)) {
                ?>
                    <option id="kom" class="<?php echo $row['kd_gkom']; ?>" value="<?php echo $row['kd_komoditi']; ?>">
                        <?php echo $row['nm_komoditi_ind']; ?>
                    </option>
                <?php
                }
                ?>
            </select>
        
<td>SEARCH :</td>
<td><input class='search' type="text" name="txtsearch" style="width:200px" value="" /> </td>
<td><input class='cari' type="submit" value="Cari" name="submit" style="width:70px"/></td>
<br></br>

</form>

        <script src="jquery-1.10.2.min.js"></script>
        <script src="jquery.chained.min.js"></script>
        <script>
            $("#bid").chained("#sbu");
            $("#subbid").chained("#bid");
            $("#gkom").chained("#subbid");
            $("#kom").chained("#gkom");
            //$("#subbid").chained("#kom");
        </script>


<!-- tabel -->


<?php  
  if (isset($_POST['submit'])) {
   $search = $_POST['txtsearch'];  
   $sbunya = $_POST['sbu'];  
   $bidnya = $_POST['bid']; 
   $subbidnya = $_POST['subbid']; 
   $gkomnya = $_POST['gkom']; 
   $komnya = $_POST['kom'];
   
   
   if ($bidnya == ''){
	   if ($search == ''){
		  $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya'"; 
	   } else {
		  $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and nm_jasa_ind like '%$search%'";
	   }	   
   } else if ($subbidnya == ''){
	   if ($search == ''){
		   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya'";
	   } else {
		   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and nm_jasa_ind like '%$search%'";
	   }
   } else if ($gkomnya == ''){
	   if ($search == ''){
	   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya'";
	   } else {
	   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and nm_jasa_ind like '%$search%'";
	   }
   } else if ($komnya == ''){
	   if ($search == ''){
	   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya'";
	   } else {
	   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya' and nm_jasa_ind like '%$search%'";
	   }
   } else {
	   if ($search == ''){
	   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya' and kd_komoditi = '$komnya'";
	   } else {
	   $sql = "SELECT * FROM jasa WHERE kd_sbu = '$sbunya' and kd_bid = '$bidnya' and kd_subbid = '$subbidnya' and kd_gkom = '$gkomnya' and kd_komoditi = '$komnya' and nm_jasa_ind like '%$search%'";
	   }
   }
   
   $i=1;
   $result = mysqli_query($db, $sql) or die('Error, list jasa failed. ' . mysqli_error());  
       
   if (mysqli_num_rows($result) == 0) { 
    echo '<p></p><p>Pencarian tidak ditemukan</p>';  
   } else {  
    //echo '<p></p>';
	
	echo '<table style="table-layout: fixed" border="2" width="1200px">';	 
     echo '<tr><td width="50px">No.</td>'; 
     echo '<td width="600px">Nama Jasa</td>'; 
     echo '<td width="150px">Methode</td>'; 
     echo '<td width="150px">Persyaratan</td>'; 
     echo '<td width="70px">Sat Harga</td>'; 
     echo '<td width="100px">Harga</td></tr>';
	 
    while ($row = mysqli_fetch_array($result)) {  
     extract($row); 
	$harga = $row['hrg'];
	$hargaa = number_format($harga,0,',','.');
	 
     echo '<tr><td align="top">'.$i.'</td>'; 
     echo '<td align="left">'.$nm_jasa_ind.'</td>';  
     echo '<td align="top">'.$methode.'</td>'; 
     echo '<td align="top">'.$persyaratan.'</td>'; 
     echo '<td align="top">'.$sat_hrg.'</td>'; 
     echo '<td align="right">'.$hargaa.'</td></tr>';  
     $i++;
    }
     echo '</table>';
     echo '<p></p>';
   }
  }
?>  
<!--</form>-->
			  
			  
            </p>
          </div>
        </div>
      </div>
    </div>
  </section>
  </body>

</html>
Silahkan login untuk menjawab!