Hiden data pada table bootstrap

hallo selamat pagi, mau bertanya tentang tabel, gimana yah supaya data pada tabel nya ter hiden dan data akan muncul ketika kita klik button search dan tidak mengganggu fungsi paggination...

<?php
		include 'pagination1.php';
		include 'conection.php';

		if(isset($_GET['search'])){
		$customer = $_GET['customer'];
		$material = $_GET['material'];
		$collor = $_GET['collor'];
		$size = $_GET['size'];
		$model = $_GET['model'];
}
$sql =("select  ci_id,cp_cid,cp_mate,cp_hues,cp_width,cp_mode,cp_name,cp_unit,cp_cury,cp_pack,cp_price,cp_date,cp_weight,cp_cprice,cp_uprice,cp_temp FROM [cust_pric] JOIN [cust_info] on cp_cid = ci_id where cp_flag=0 and (cp_cid like '%".$customer."%' and cp_mate like '%".$material."%' and cp_hues like '%".$collor."%' and cp_width like '%".$size."%' and cp_mode like '%".$model."%'  )");

$result = mssql_query($sql);

        //pagination config start
        $rpp = 15; // jumlah record per halaman
        $reload = "menu2.php?page = true";
        $page =isset ($_GET['page']) ? intval ($_GET ['page']) :1;
        if($page<=0) $page = 1;
        $tcount = mssql_num_rows($result);
        $tpages = isset($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number
        $count = 0;
        $i = ($page-1)*$rpp;
        $no_urut = ($page-1)*$rpp;
        $_SESSION['id'] = $no_urut;
        //pagination config end

?>
<thead>
                 <tr>
		 <th><center> No </center></th>
          	 <th ><center> Id_Customer</center></th>
           	 <th ><center> Material</center></th>
           	 <th ><center> Color</center></th>
          	 <th ><center> Size</center></th>
		 <th ><center> Model</center></th>
          	 <th ><center> Name</center></th>
          	 <th ><center>Unit</center></th>
           	 <th ><center>Cp_cury</center></th>
           	 <th ><center>Packing</center></th>
           	 <th ><center>Price Low</center></th>
           	 <th ><center>Price Higt</center></th>
           	 <th ><center>Weight</center></th>
           	 <th ><center>Date</center></th>
                 </tr>
 </thead>
 <tbody>
<?php
if(isset($_GET['search'])){
$customer = $_GET['customer'];
$material = $_GET['material'];
$collor = $_GET['collor'];
$size = $_GET['size'];
$model = $_GET['model'];
echo"<b>Search result : ".$customer." ".$material." ".$collor." ".$size." ".$model."<b>";
}

?>
<?php
             while(($count<$rpp) && ($i<$tcount)) {
               mssql_data_seek($result,$i);
               $data = mssql_fetch_array($result);

               ?>

<tr>
<td ><center><?php echo ++$no_urut;?></center> </td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_cid']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_mate']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_hues']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_width']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_mode']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_name']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_unit']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_cury']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_pack']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>" <?php

$A = $data['cp_price'];
$B = $data['cp_cprice'];
$nilai = (($A/$B)*100);

 if ($nilai<15) {
echo 'style="color: #FF0000;"';
}else{
echo 'style="color: #33FFFF"';
}
 ?> ><?php echo $data['cp_price']; ?></td>

<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_cprice']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_weight']; ?></td>
<td class=" md-trigger" data-modal="modal-3" data-id="<?php $data['ci_id']?>"><?php echo $data['cp_date']; ?></td>
</tr>

<?php
     $i++;
        $count++;
    }

 ?>
	</tbody>

</table>

</div>

<div><center><?php echo paginate_one($reload, $page, $tpages); ?></center></div>
</section>

avatar Obbytokun
@Obbytokun

186 Kontribusi 16 Poin

Diperbarui 5 tahun yang lalu

3 Jawaban:

Coba kasih id pada tabel trus search nya pake JavaScript (tambahin fungsi hiddenpada JavaScript saat tombol search di klik). Kalau saya pakai remove biar gak ganggu pas update datanya. Klo hidden id/name nya numpuk jadi salah ambil data.

Maaf klo keliru saya masih newbie yang ingin membantu heheh

avatar Adinur
@Adinur

63 Kontribusi 8 Poin

Dipost 5 tahun yang lalu

pakai ajax gan

avatar kikimf
@kikimf

91 Kontribusi 78 Poin

Dipost 5 tahun yang lalu

Tanggapan

apa nya gan pake ajax? punya referensi nya gak gan?

http://programmerblog.net/jquery-ajax-get-example-php-mysql/

ketika cuma nampil biasa tanpa search agan bisa narik dari database lewat php biasa pakai command mysqli dst, ketika orang isi field search dan disubmit baru nembak data ke api lewat jquery ajax tag table nya di empty() dulu lewat jquery baru main DOM deh di append ke tag table hasil dari response api nya

pakek api juga gan?

masukkin query pencarian dan tampilan tabel ke if, jadi data tampil saat ada triger search <pre> if(isset($_GET['search'])){} </pre>

avatar dianarifr
@dianarifr

642 Kontribusi 316 Poin

Dipost 5 tahun yang lalu

Tanggapan

sudah di coba gan tapi fungsi pagination nya jadi ngaco

Login untuk ikut Jawaban