- Beranda
- Komunitas
- Tech
- Programmer Forum
[ASK] Filter Data atau Pencarian Data menggunakan Combobox pakai PHP gagal tampil?
TS
bagusGooners14
[ASK] Filter Data atau Pencarian Data menggunakan Combobox pakai PHP gagal tampil?
Assalaamu'alaikum Wr.Wb, agan-agan atau aganwati yang ahli pemrograman PHP saya mau tanya untuk kesalahan coding yang saya buat terletak di mananya ya? jadi sistem yang saya buat itu untuk mencari aplikasi yang cocok dengan spesifikasi komputer pengguna, untuk menentukan spesifikasinya pengguna harus memilih melalui combobox bertingkat/berkaitan dan setelah diproses akan muncul aplikasi yang sesuai dengan kriteria lalu akan muncul dalam tabel. Masalahnya pada saat diproses tidak ada data yang muncul dalam tabel, mohon bantuannya master-master hehe
kira2 apa yang salah ya? hehe
Spoiler for form combobox:
<?php require_once "admin/config/config.php"; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="Create by bagus">
<meta name="author" content="facebook.com/bagus.Gooners">
<link rel="shortcut icon" href="">
<!-- Author pimen -->
<title>Sistem Rekomendasi Aplikasi Permainan dan Multimedia</title>
<link href="dist/css/bootstrap.css" rel="stylesheet">
<!-- DataTables CSS -->
<link href="dist/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">
<!-- DataTables Responsive CSS -->
<link href="dist/bower_components/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet">
<link href="dist/css/style.css" rel="stylesheet">
</head>
<body>
<?php
include 'header.php';
if (isset($_GET['id']) == '') {
header('location:index.php?id=main');
}else{
if ($_GET['id'] == 'main') {
include 'content_utama.php';
}else if ($_GET['id'] == 'tentang_kami') {
include 'tentang_kami.php';
}else if ($_GET['id'] == 'data_aplikasi') {
include 'content1.php';
}else if ($_GET['id'] == 'rekomendasi') {
include 'menukedua.php';
}else if ($_GET['id'] == 'rekomendasi_aplikasi') {
//
?>
<section id="center">
<div class="container">
<div class="row">
<div class="panel panel-success" style="margin-left:-5px; ">
<!-- Default panel contents -->
<div class="panel-heading"><center><b>Tentukan Jenis Aplikasi dan Spesifikasi Komputer Anda</b></center></div>
<div class="panel-body">
<form id="validate-form" class="block-content form" action="index.php?id=rekomendasi" method="POST" enctype="multipart/form-data">
<p>
<label>Jenis Aplikasi:</label><br />
<select name="aplikasi" id="j_aplikasi" class="form-control">
<option value="Pilih Kategori" selected>Pilih Jenis Aplikasi</option>
<?php
$aplikasi = mysql_query("SELECT * FROM aplikasi ORDER BY jenis_aplikasi");
while($p=mysql_fetch_array($aplikasi)){
echo "<option value=\"$p[id]\">$p[jenis_aplikasi]</option>\n";
}
?>
</select><br />
<label>Genre Aplikasi:</label><br />
<select name="genre_aplikasi" id="g_aplikasi" class="form-control">
<option value="Pilih Kategori" selected>Pilih Genre Aplikasi</option>
<option></option>
</select><br />
<label>Brand Processor:</label><br />
<select name="processor" id="b_processor" class="form-control">
<option value="Pilih Kategori" selected>Pilih Brand Processor</option>
<?php
$processor = mysql_query("SELECT * FROM processor ORDER BY brand_cpu");
while($p=mysql_fetch_array($processor)){
echo "<option value=\"$p[id]\">$p[brand_cpu]</option>\n";
}
?>
</select><br />
<label>Tipe Processor:</label><br />
<select name="tipe_cpu" id="tipe_proc" class="form-control">
<option value="Pilih Kategori" selected>Pilih Tipe Processor</option>
<option></option>
</select><br />
<label>Kapasitas RAM:</label><br />
<select name="ram" id="kap_ram" class="form-control">
<option value="Pilih Kategori" selected>Pilih</option>
<?php
$ram = mysql_query("SELECT * FROM ram ORDER BY kapasitas");
while($p=mysql_fetch_array($ram)){
echo "<option value=\"$p[id]\">$p[kapasitas]</option>\n";
}
?>
</select><br />
<label>Brand Graphic Processing Unit:</label><br />
<select name="gpu" id="b_gpu" class="form-control">
<option value="Pilih Kategori" selected>Pilih Brand GPU</option>
<?php
$gpu = mysql_query("SELECT * FROM gpu ORDER BY brand_gpu");
while($p=mysql_fetch_array($gpu)){
echo "<option value=\"$p[id]\">$p[brand_gpu]</option>\n";
}
?>
</select><br />
<label>Tipe Graphic Processing Unit:</label><br />
<select name="tipe_gpu" id="t_gpu" class="form-control">
<option value="Pilih Kategori" selected>Pilih Tipe GPU</option>
<option></option>
</select><br />
<label>Versi Sistem Operasi Windows:</label><br />
<select name="os" id="v_os" class="form-control">
<option value="Pilih Kategori" selected>Pilih Versi Windows</option>
<?php
$os = mysql_query("SELECT * FROM os ORDER BY versi");
while($p=mysql_fetch_array($os)){
echo "<option value=\"$p[id]\">$p[versi]</option>\n";
}
?>
</select><br />
</p>
<div class="clear"></div>
<!-- Buttons with actionbar -->
<div class="block-actions">
<input type="submit" name="search" class="form-control" class="button" value="Proses"></li>
</div> <!--! end of #block-actions -->
</form>
</div>
<!-- Table -->
</div>
</div>
</section>
<?php
}else{
?>
<section id="center">
<div class="container">
<div class="row">
<div class="panel panel-danger" style="margin-left:-5px; ">
<!-- Default panel contents -->
<div class="panel-heading"><center><b>Maaf, Halaman Belum Tersedia</b></center></div>
<!-- Table -->
</div>
</div>
</section>
<?php
}}
include 'footer.php'; ?>
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
<!-- DataTables JavaScript -->
[removed][removed]
[removed][removed]
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
[removed]
$(document).ready(function() {
$("#form").validate({
rules: {
kategori: "required"
},
messages: {
kategori: {
required: ''
},
},
success: function(label) {
label.text('').addClass('valid');
}
});
});
[removed]
[removed]
$(document).ready(function() {
$('#j_aplikasi').change(function () {
var aplikasi_id = $(this).val();
$.ajax({
type:'POST',
url:'genre_aplikasi.php',
data:'aplikasi_id='+aplikasi_id,
success: function(response) {
$('#g_aplikasi').html(response);
}
});
})
});
[removed]
[removed]
$(document).ready(function() {
$('#b_processor').change(function () {
var cpu_id = $(this).val();
$.ajax({
type:'POST',
url:'tipe_cpu.php',
data:'cpu_id='+cpu_id,
success: function(response) {
$('#tipe_proc').html(response);
}
});
})
});
[removed]
[removed]
$(document).ready(function() {
$('#b_gpu').change(function () {
var gpu_id = $(this).val();
$.ajax({
type:'POST',
url:'tipe_gpu.php',
data:'gpu_id='+gpu_id,
success: function(response) {
$('#t_gpu').html(response);
}
});
})
});
[removed]
[removed]
$(document).ready(function() {
$('#matrikawal').DataTable({
responsive: true
});
});
$(document).ready(function() {
$('#matriknormalisasi').DataTable({
responsive: true
});
}); $(document).ready(function() {
$('#nilaikriteriawisata').DataTable({
responsive: true
});
});
$(document).ready(function() {
$('#dataTables-example').DataTable({
responsive: true
});
});
$(document).ready(function() {
$('#data_wisata').DataTable({
responsive: true
});
});
[removed]
[removed]
$(document).ready(function() {
$('#a').DataTable({
responsive: true
});
}); $(document).ready(function() {
$('#b').DataTable({
responsive: true
});
});
[removed]
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="Create by bagus">
<meta name="author" content="facebook.com/bagus.Gooners">
<link rel="shortcut icon" href="">
<!-- Author pimen -->
<title>Sistem Rekomendasi Aplikasi Permainan dan Multimedia</title>
<link href="dist/css/bootstrap.css" rel="stylesheet">
<!-- DataTables CSS -->
<link href="dist/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">
<!-- DataTables Responsive CSS -->
<link href="dist/bower_components/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet">
<link href="dist/css/style.css" rel="stylesheet">
</head>
<body>
<?php
include 'header.php';
if (isset($_GET['id']) == '') {
header('location:index.php?id=main');
}else{
if ($_GET['id'] == 'main') {
include 'content_utama.php';
}else if ($_GET['id'] == 'tentang_kami') {
include 'tentang_kami.php';
}else if ($_GET['id'] == 'data_aplikasi') {
include 'content1.php';
}else if ($_GET['id'] == 'rekomendasi') {
include 'menukedua.php';
}else if ($_GET['id'] == 'rekomendasi_aplikasi') {
//
?>
<section id="center">
<div class="container">
<div class="row">
<div class="panel panel-success" style="margin-left:-5px; ">
<!-- Default panel contents -->
<div class="panel-heading"><center><b>Tentukan Jenis Aplikasi dan Spesifikasi Komputer Anda</b></center></div>
<div class="panel-body">
<form id="validate-form" class="block-content form" action="index.php?id=rekomendasi" method="POST" enctype="multipart/form-data">
<p>
<label>Jenis Aplikasi:</label><br />
<select name="aplikasi" id="j_aplikasi" class="form-control">
<option value="Pilih Kategori" selected>Pilih Jenis Aplikasi</option>
<?php
$aplikasi = mysql_query("SELECT * FROM aplikasi ORDER BY jenis_aplikasi");
while($p=mysql_fetch_array($aplikasi)){
echo "<option value=\"$p[id]\">$p[jenis_aplikasi]</option>\n";
}
?>
</select><br />
<label>Genre Aplikasi:</label><br />
<select name="genre_aplikasi" id="g_aplikasi" class="form-control">
<option value="Pilih Kategori" selected>Pilih Genre Aplikasi</option>
<option></option>
</select><br />
<label>Brand Processor:</label><br />
<select name="processor" id="b_processor" class="form-control">
<option value="Pilih Kategori" selected>Pilih Brand Processor</option>
<?php
$processor = mysql_query("SELECT * FROM processor ORDER BY brand_cpu");
while($p=mysql_fetch_array($processor)){
echo "<option value=\"$p[id]\">$p[brand_cpu]</option>\n";
}
?>
</select><br />
<label>Tipe Processor:</label><br />
<select name="tipe_cpu" id="tipe_proc" class="form-control">
<option value="Pilih Kategori" selected>Pilih Tipe Processor</option>
<option></option>
</select><br />
<label>Kapasitas RAM:</label><br />
<select name="ram" id="kap_ram" class="form-control">
<option value="Pilih Kategori" selected>Pilih</option>
<?php
$ram = mysql_query("SELECT * FROM ram ORDER BY kapasitas");
while($p=mysql_fetch_array($ram)){
echo "<option value=\"$p[id]\">$p[kapasitas]</option>\n";
}
?>
</select><br />
<label>Brand Graphic Processing Unit:</label><br />
<select name="gpu" id="b_gpu" class="form-control">
<option value="Pilih Kategori" selected>Pilih Brand GPU</option>
<?php
$gpu = mysql_query("SELECT * FROM gpu ORDER BY brand_gpu");
while($p=mysql_fetch_array($gpu)){
echo "<option value=\"$p[id]\">$p[brand_gpu]</option>\n";
}
?>
</select><br />
<label>Tipe Graphic Processing Unit:</label><br />
<select name="tipe_gpu" id="t_gpu" class="form-control">
<option value="Pilih Kategori" selected>Pilih Tipe GPU</option>
<option></option>
</select><br />
<label>Versi Sistem Operasi Windows:</label><br />
<select name="os" id="v_os" class="form-control">
<option value="Pilih Kategori" selected>Pilih Versi Windows</option>
<?php
$os = mysql_query("SELECT * FROM os ORDER BY versi");
while($p=mysql_fetch_array($os)){
echo "<option value=\"$p[id]\">$p[versi]</option>\n";
}
?>
</select><br />
</p>
<div class="clear"></div>
<!-- Buttons with actionbar -->
<div class="block-actions">
<input type="submit" name="search" class="form-control" class="button" value="Proses"></li>
</div> <!--! end of #block-actions -->
</form>
</div>
<!-- Table -->
</div>
</div>
</section>
<?php
}else{
?>
<section id="center">
<div class="container">
<div class="row">
<div class="panel panel-danger" style="margin-left:-5px; ">
<!-- Default panel contents -->
<div class="panel-heading"><center><b>Maaf, Halaman Belum Tersedia</b></center></div>
<!-- Table -->
</div>
</div>
</section>
<?php
}}
include 'footer.php'; ?>
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
[removed][removed]
<!-- DataTables JavaScript -->
[removed][removed]
[removed][removed]
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
[removed]
$(document).ready(function() {
$("#form").validate({
rules: {
kategori: "required"
},
messages: {
kategori: {
required: ''
},
},
success: function(label) {
label.text('').addClass('valid');
}
});
});
[removed]
[removed]
$(document).ready(function() {
$('#j_aplikasi').change(function () {
var aplikasi_id = $(this).val();
$.ajax({
type:'POST',
url:'genre_aplikasi.php',
data:'aplikasi_id='+aplikasi_id,
success: function(response) {
$('#g_aplikasi').html(response);
}
});
})
});
[removed]
[removed]
$(document).ready(function() {
$('#b_processor').change(function () {
var cpu_id = $(this).val();
$.ajax({
type:'POST',
url:'tipe_cpu.php',
data:'cpu_id='+cpu_id,
success: function(response) {
$('#tipe_proc').html(response);
}
});
})
});
[removed]
[removed]
$(document).ready(function() {
$('#b_gpu').change(function () {
var gpu_id = $(this).val();
$.ajax({
type:'POST',
url:'tipe_gpu.php',
data:'gpu_id='+gpu_id,
success: function(response) {
$('#t_gpu').html(response);
}
});
})
});
[removed]
[removed]
$(document).ready(function() {
$('#matrikawal').DataTable({
responsive: true
});
});
$(document).ready(function() {
$('#matriknormalisasi').DataTable({
responsive: true
});
}); $(document).ready(function() {
$('#nilaikriteriawisata').DataTable({
responsive: true
});
});
$(document).ready(function() {
$('#dataTables-example').DataTable({
responsive: true
});
});
$(document).ready(function() {
$('#data_wisata').DataTable({
responsive: true
});
});
[removed]
[removed]
$(document).ready(function() {
$('#a').DataTable({
responsive: true
});
}); $(document).ready(function() {
$('#b').DataTable({
responsive: true
});
});
[removed]
</body>
</html>
Spoiler for proses filter:
<?php require_once "admin/config/config.php"; ?>
<div class="panel panel-info" style="margin-left:-30px; width:1020px;">
<div class="panel-heading">
Hasil Rekomendasi
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="dataTable_wrapper">
<table id="dataTables-example" style="margin-left:-16px; " class=" table table-striped table-bordered table-hover" >
<thead>
<tr>
<th>id</th>
<th>Nama Aplikasi</th>
<th>Jenis Aplikasi</th>
<th>Genre Aplikasi</th>
<th>Processor</th>
<th>RAM</th>
<th>GPU</th>
<th>Harddisk</th>
<th>OS</th>
</tr>
</thead>
<?php
$search_aplikasi = $_POST['aplikasi'];
$search_genre_aplikasi = $_POST['genre_aplikasi'];
$search_tipe_cpu = $_POST['tipe_cpu'];
$search_ram = $_POST['ram'];
$search_tipe_gpu = $_POST['tipe_gpu'];
$search_os = $_POST['os'];
$get_sis = mysql_query ("select * from data_aplikasi where data_aplikasi.jenis_aplikasi like '%$search_aplikasi%' and data_aplikasi.genre_aplikasi like '%$search_genre_aplikasi%' and data_aplikasi.processor like '%$search_tipe_cpu%' and data_aplikasi.ram like '%$search_ram%' and data_aplikasi.gpu like '%$search_tipe_gpu%' and data_aplikasi.os like '%$search_os%'");
while ($row_sis=mysql_fetch_array($get_sis)){?>
<tbody>
<tr class='odd gradeX'>
<td><center><?php echo"$row_sis[id]";?></center></td>
<td><center><?php echo"$row_sis[nama_aplikasi]";?></center></td>
<td><center><?php echo"$row_sis[jenis_aplikasi]";?></center></td>
<td><center><?php echo"$row_sis[genre_aplikasi]";?></center></td>
<td><center><?php echo"$row_sis[processor]";?></center></td>
<td><center><?php echo"$row_sis[ram]";?></center></td>
<td><center><?php echo"$row_sis[gpu]";?></center></td>
<td><center><?php echo"$row_sis[harddisk]";?></center></td>
<td><center><?php echo"$row_sis[os]";?></center></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
<div class="panel panel-info" style="margin-left:-30px; width:1020px;">
<div class="panel-heading">
Hasil Rekomendasi
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="dataTable_wrapper">
<table id="dataTables-example" style="margin-left:-16px; " class=" table table-striped table-bordered table-hover" >
<thead>
<tr>
<th>id</th>
<th>Nama Aplikasi</th>
<th>Jenis Aplikasi</th>
<th>Genre Aplikasi</th>
<th>Processor</th>
<th>RAM</th>
<th>GPU</th>
<th>Harddisk</th>
<th>OS</th>
</tr>
</thead>
<?php
$search_aplikasi = $_POST['aplikasi'];
$search_genre_aplikasi = $_POST['genre_aplikasi'];
$search_tipe_cpu = $_POST['tipe_cpu'];
$search_ram = $_POST['ram'];
$search_tipe_gpu = $_POST['tipe_gpu'];
$search_os = $_POST['os'];
$get_sis = mysql_query ("select * from data_aplikasi where data_aplikasi.jenis_aplikasi like '%$search_aplikasi%' and data_aplikasi.genre_aplikasi like '%$search_genre_aplikasi%' and data_aplikasi.processor like '%$search_tipe_cpu%' and data_aplikasi.ram like '%$search_ram%' and data_aplikasi.gpu like '%$search_tipe_gpu%' and data_aplikasi.os like '%$search_os%'");
while ($row_sis=mysql_fetch_array($get_sis)){?>
<tbody>
<tr class='odd gradeX'>
<td><center><?php echo"$row_sis[id]";?></center></td>
<td><center><?php echo"$row_sis[nama_aplikasi]";?></center></td>
<td><center><?php echo"$row_sis[jenis_aplikasi]";?></center></td>
<td><center><?php echo"$row_sis[genre_aplikasi]";?></center></td>
<td><center><?php echo"$row_sis[processor]";?></center></td>
<td><center><?php echo"$row_sis[ram]";?></center></td>
<td><center><?php echo"$row_sis[gpu]";?></center></td>
<td><center><?php echo"$row_sis[harddisk]";?></center></td>
<td><center><?php echo"$row_sis[os]";?></center></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
kira2 apa yang salah ya? hehe
nona212 memberi reputasi
1
4.8K
Kutip
8
Balasan
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Urutan
Terbaru
Terlama
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan