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!

combobox pada php

annisa · Apr 9, 2018
haloo..saya buat combobox bercabang di php dari mysql, kayanya data dari field yg saya akan tampilkan ke combobox itu kepanjangan deh, jd dia gamau tampil..gimana cara nya supaya bisa tampil yah ? kalau harus dipotong karakternya ntar jd ga kebaca semua donng..mohon bantuannya.. terima kasih. *saya lampirkan kodingan saya..
<script language='javascript'>

function showKom()

{

<?php

include"config.php";

// membaca semua propinsi

$query = "SELECT * FROM gkom";

$hasil = mysqli_query($db, $query);

// membuat if untuk masing-masing pilihan propinsi beserta isi option untuk combobox kedua

while ($data = mysqli_fetch_array($hasil))

{

$gkom = $data['kd_gkom'];
// membuat IF untuk masing-masing propinsi

echo "if (document.form1.gkom.value == \"".$gkom."\")";

echo "{";

// membuat option kota untuk masing-masing propinsi

$query2 = "SELECT * FROM komoditi WHERE kd_gkom = '$gkom'";

$hasil2 = mysqli_query($db, $query2);

$content = "document.getElementById('kom').innerHTML = \"";

while ($data2 = mysqli_fetch_array($hasil2))

	//$nm_kom = substr($data2['nm_komoditi_ind'],0);
{
$content .= "<option value='".$data2['kd_komoditi']."'>".$data2['nm_komoditi_ind']."</option>";
}

$content .= "\"";

echo $content;

echo "}\n";

}

?>

}

</script>
Silahkan login untuk menjawab!
<?php
include "../../config/koneksi.php";

$barcode	=$_POST['barcode'];
$tglscn		=$_POST['tgl'];
$user		=$_POST['user'];	
$kndsi		=$_POST['kndsi'];
$tgl = substr($barcode,4,6);
$tgl = date('d-m-Y', strtotime($tgl));


$query = mysql_query("INSERT INTO scan_nrb (barcode,tgl_scan,user,kondisi) VALUES ('$barcode','$tglscn','$user','$kndsi')");
if ($query)
{

	$query2 = mysql_query("UPDATE scan_nrb SET toko=LEFT(barcode,4),tgl='$tgl',NO=RIGHT(barcode,4) where barcode='$barcode';") or die(mysql_error());
		 echo "<META HTTP-EQUIV=Refresh CONTENT='0; URL=../../media.php?module=reg-nrb'>";
}	
else
{ 
	echo "gagal ..."; 
}
?>
master mau tanya dong, gimana ya caranya supaya data tgl yg ada di db menjadi tanggal indo.

contoh barcode nya TEST2811171234 yg 281117 itu adalah tanggal.
kode yg saya buat seperti di atas, terimakasih:)
Silahkan login untuk menjawab!
Salam kenal gan, saya mau tanya saya lg coba buat ambil photo dari webcam dan juga menginput keterangan gambar, tetapi yang masuk hanya gambar kedalam database sedangkan untuk keterangan tidak masuk apa ada yg salah ya? trima kasih
Silahkan login untuk menjawab!
salam.
mau bertanya nih . untuk konfigursi file .htaccess yang benar bagaimana yah. supaya ketika membuka web addondomain tidak jadi www.domainutama.com/addondomain.com. harusnya linknya www.addondomain.com.

code .htaccess saat ini :
<IfModule mod_rewrite.c>
	Options -Indexes
        RewriteEngine on
        DirectoryIndex index.php
        RewriteCond %{HTTPS} off
        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        <IfModule mod_php5.c>
                RewriteRule ^(.*)$ index.php/$1 [L]
        </IfModule>
        <IfModule !mod_php5.c>
                RewriteRule ^(.*)$ index.php?/$1 [L]
        </IfModule>
</IfModule>
<IfModule !mod_rewrite.c>
        ErrorDocument 404 /index.php
</IfModule>

fungsi di atas : meredict web utama ke https://www. kasusnya sub dommain/addon domain juga ngikutin ke https & www. bagaimana ya kode yang benar ??
Terimakasih.
Silahkan login untuk menjawab!
Selamat malam ka,
Saya mau tanya.. saya punya tabel verifikasi yang atribut nya : no_verif, id_lembaga, nphd, sptjb, cpy_buku_rekening, dok_legalitas, status.

Pas di form verifikasi nya, nphd, sptjb, cpy_buku_rekening, dok_legalitas nya saya menggunakan checkbox.
Jika checkbox nya di pilih semua, maka otomatis status nya "lolos", jika checkbox nya hanya dipilih beberapa, maka statusnya "tidak lolos".

Mohon pencerahannya ka, saya baru belajar.😉👍
Silahkan login untuk menjawab!