Mas gimana cara menambah combobox untuk pencarian misalkan 2 combobox. yang aku dapat cuma 1 combobox untuk pencarian Mysql nya....
script ku kurang lebih seperti ini >
index.php
<html>
  <head>
  	    <style type="text/css">
            #container{
               width:800px;
               margin:0 auto;
            }

            #searchi{
               width:700px;
               padding:10px;
            }

            #button{
               display: block;
               width: 100px;
               height:30px;
               border:solid #366FEB 1px;
               background: #91B2FA;
            }

            ul{
            	margin-left:-40px;
            }

            ul li{
            	list-style-type: none;
            	border-bottom: dotted 1px black;
              height: 50px;
            }

            li:hover{
            	background: #A592E8;
            }

            a{
            	text-decoration: none;
              font-size: 18px;
            }
  	    </style>
        <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                 function search(){

                      var judul=$("#search").val();
                      if(judul!="")
					  {
                        $("#result").html("<img src='img/ajax-loader.gif'/>");
                         $.ajax({
                            type:"POST",
                            url:"check.php",
                            data:"judul="+judul,
                            success:function(data){
                                $("#result").html(data);
                                $("#search").val("");
                             }
                          });
                      }
                      

                     
                 }

                  $("#button").click(function(){
                  	 search();
                  });

                  $('#search').keyup(function(e) {
                     if(e.keyCode == 13) {
                        search();
                      }
                  });
            });
        </script>
  </head>
  <body>
        <div id="container">
        <select id="search" placeholder="Cari">
                               <option value="#">-----</option>
        <option value="pegawai">pegawai</option>
        </select>
             <input type="button" id="button" value="Cari" />
             <ul id="result"></ul>
        </div>
  </body>
</html>
check.php
<?php
 include "con.php";
 $judul=$_POST["judul"];
 
 $result=mysql_query("SELECT * FROM btn where pegawai like '%$judul%'");
 $found=mysql_num_rows($result);
 
 if($found>0){
    while($row=mysql_fetch_array($result)){
    echo "<li>$row[gaji]</br>
            <a href=\"$row[link]\">$row[link]</a></li>";
    }   
 }else{
    echo "<li>Tidak ada artikel yang ditemukan <li>";
 }
?>
itu cuma 1 combobox gimana kalau ditambah satu combobox ?
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Nov 29, 2013 · 0 Suka · 0 Tidak Suka
<html>
   <head>
      <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
      <script type="text/javascript">
         $(document).ready(function(){
         function search(){
	         $("#result").html("<img src='img/ajax-loader.gif'/>");
	         $.ajax({
	         	type:"POST",
	         	url:"check.php",
	         	data:$('form').serialize(),
	         	success:function(data){
		         $("#result").html(data);
	         	}
	         }); 
          }

         $("#button").click(function(){
         	search();
         });
         
         });
      </script>
   </head>
   <body>
      <div id="container">
      	<form action="">
         <select name="judul" placeholder="Cari">
            <option value="#">-----</option>
            <option value="pegawai">pegawai</option>
         </select>
         <select name="tipe" placeholder="Cari">
            <option value="#">-----</option>
            <option value="pegawai">tipe1</option>
         </select>
         <input type="button" id="button" value="Cari" />
         </form>
         <ul id="result"></ul>
      </div>
   </body>
</html>
    <?php
    include "con.php";
    $judul=$_POST["judul"];
    $tipe = $_POST['tipe'];
     
    $result=mysql_query("SELECT * FROM btn where pegawai like '%$judul%' and tipe like '%$tipe%'");
    $found=mysql_num_rows($result);
     
    if($found>0){
    	while($row=mysql_fetch_array($result)){
	    echo "<li>$row[gaji]</br>
	    <a href=\"$row[link]\">$row[link]</a></li>";
	 }
    }else{
	    echo "<li>Tidak ada artikel yang ditemukan <li>";
    }
    ?>
pelajari lagi :
http://www.myphptutorials.com/tutorials/40/membuat-searching-skrip-pencarian-data
0
Loading...
agus ishaq · Jan 1, 2014 · 0 Suka · 0 Tidak Suka
master bagaimana solusinya uda saya coba tetap gagal
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="shoes store, free template, ecommerce, online shop, website templates, CSS, HTML" />
<meta name="description" content="Shoes Store is a free ecommerce template provided by templatemo.com" />
<link href="templatemo_style.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />

<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">

/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script type="text/javascript">

ddsmoothmenu.init({
	mainmenuid: "top_nav", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>

<style type="text/css">
<!--
.style6 {font-size: 16px}
.style13 {color: #000000}
.style1 {	font-family: "Times New Roman", Times, serif;
	font-weight: bold;
	color: #228B22;
	font-size: 20px
}
.style16 {font-weight: bold}
.style30 {color: #FF0000;
	font-weight: bold;
	font-style: italic;
}
.style21 {font-size: 18px}
.style40 {
	font-size: 16px;
	font-weight: bold;
	color: #2f2f2f;
}
.style41 {font-size: 24px; }
.style42 {color: #FFFFFF}
.style43 {
	color: #0000FF;
	font-weight: bold;
}
.style47 {color: #000000; font-weight: bold; }
.style48 {font-size: 14px}
.style50 {font-size: 14px; font-weight: bold; }
body {
	background-color: #F0F0F0;
}
.style51 {font-size: 16px; color: #000000; }
.style52 {
	color: #FF0000;
	font-weight: bold;
}
.style53 {color: #FF0000}
-->
</style>
</head>

<body>


<div id="templatemo_body_wrapper">
<div id="templatemo_wrapper">

	<div id="templatemo_header">
   	  <div id="site_title">    	  <h1><a href=""></a></h1>

   	  </div>
        <div class="cleaner"> </div>
    </div> <!-- END of templatemo_header -->
    
    <div id="templatemo_menubar">
    	<div id="top_nav" class="ddsmoothmenu">
            <ul>
                <li></li>
                <li>
                  <!-- END of templatemo_menubar -->
<div id="templatemo_main">
  <div id="sidebar" class="float_l"></div>
    	<div id="content" class="float_r">
    	  <p>
              <?php
  
$host="localhost";
$user="root";
$password="";
$db="db_jualbeli";


$con=mysql_connect("$host","$user","$password");
mysql_select_db($db,$con) or die(mysql_error());


mysql_select_db("pagination");//fungsi pagination
$BatasAwal = 7;
if (!empty($_GET['page'])) {
$hal = $_GET['page'] - 1;
$MulaiAwal = $BatasAwal * $hal;
} else if (!empty($_GET['page']) and $_GET['page'] == 1) {
$MulaiAwal = 0;
} else if (empty($_GET['page'])) {
$MulaiAwal = 0; }

?>
 

          <h2>&nbsp;</h2>
          <form action="cari.php" method="post">
            <table>
              <tr>
                <td><span class="style53">Berdasarkan :</span> </td>
                <td><select name="berdasarkan">
                    <option value="--Pilih Berdasarkan--">--Pilih Berdasarkan--</option>
                    <option value="Pakaian">Pakaian</option>
                    <option value="Kendaraan">Kendaraan</option>
                    <option value="Elektronik">Elektronik</option>
                    <option value="Accesories">Accesories</option>
                    <option value="Dll">Dll</option>
                </select></td>
                <td><span class="style53">Cari :</span> </td>
                <td><input type="text"  name="cari" /></td>
                <td><input type="submit" name="submit" value="Filter" /></td>
              </tr>
            </table>
          </form>
          <p>&nbsp;</p>
            <table width="499" height="142" align="center">
 
              <?php 
  	$query=("select Foto,NamaBarang,Kategori,HargaBarang FROM t_barang order by ID_Barang desc LIMIT $MulaiAwal , $BatasAwal");
	$hasil=mysql_query($query);
	while($data=mysql_fetch_array($hasil)) {

	
  ?>
              <tr>
                <th width="152" height="79" bordercolor="#000000" bgcolor="#FFFFFF"><span class="style1 style16"><img src="gambarmasuk/<?php echo $data["Foto"] ?>"width="151" height="113" /></span></th>
                <td width="244" bgcolor="#FFFFFF"><p><span class="style13"><strong>Nama Barang: </strong></span><span class="style13"><?php echo $data["NamaBarang"]?></span></p>
                  <p><span class="style13"><strong>Kategori: </strong></span> <span class="style13"><?php echo $data["Kategori"]?></span></p>
                <p><span class="style13"><strong>Harga: </strong><span class="style13">Rp.</span><?php echo $data ["HargaBarang"]?>&nbsp;</span></p></td>
                <td width="81" bgcolor="#FFFFFF"><p align="center"><a href="viewdetailbarang.php?viewdipilih=<?php echo $data['NamaBarang']?>" class="style30">View Detail </a></p>                </td>
              </tr>
              <tr>
                <th height="19" colspan="3" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;</th>
              </tr>
              <?php
	}
?>
            </table>
			
            <p>&nbsp;            </p>
            <p>
              <?	
//navigasi
$cekQuery = mysql_query("select Foto,NamaBarang,Kategori,HargaBarang FROM t_barang  ");
$jumlahData = mysql_num_rows($cekQuery);
if ($jumlahData > $BatasAwal) {
echo '<br/><center><div style="font-size:10pt;">Page... : ';
$a = explode(".", $jumlahData / $BatasAwal);
$b = $a[0];
$c = $b + 1;
for ($i = 1; $i <= $c; $i++) {
echo '<a style="text-decoration:none;';
if ($_GET['page'] == $i) {
echo 'color:red';
}
echo '" href="?page=' . $i . '">' . $i . '</a>, ';
}
echo '</div></center>';
}
?>
            </p>
            <p>
           
            </p>
            </p>
            <p>&nbsp;</p>
          </form>
          <div class="cleaner"><a href="tes.php"></a></div>
                 	
  </div>
        <div class="cleaner">
          <p><?php
echo "Anda adalah pengunjung ke :";
echo counter();
function counter(){
if (isset($visitor)){
if ($visitor=="visited")
include("counter.txt");
} else {
$file=fopen("counter.txt","r+");
$nilai=fread($file,filesize("counter.txt"));
fclose($file);
$nilai += 1;
$file=fopen("counter.txt","w+");
fputs($file,$nilai);
fclose($file);
include("counter.txt");
}
}
?>&nbsp;
<br></br>

          <!-- Histats.com  START  (standard)-->
<script type="text/javascript">document.write(unescape("%3Cscript src=%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script%3E"));</script>
<a href="http://www.histats.com" target="_blank" title="free stats" ><script  type="text/javascript" >
try {Histats.start(1,2552568,4,114,103,50,"00011111");
Histats.track_hits();} catch(err){};
</script></a>
<noscript><a href="http://www.histats.com" target="_blank"><img  src="http://sstatic1.histats.com/0.gif?2552568&101" alt="free stats" border="0"></a></noscript>
<!-- Histats.com  END  --><p>&nbsp;</p>
      </div>
</div> 
    <!-- END of templatemo_main -->
<div class="style51" id="templatemo_footer">
    	<p><strong></a> </strong></p>
        </div> 
    <!-- END of templatemo_footer -->
    
</div> <!-- END of templatemo_wrapper -->
</div> <!-- END of templatemo_body_wrapper -->

</body>
</html>