<?php
include "koneksi.php";
$cari=$_POST['cari'];
$lap=mysql_query("select*from data_warga where nama_warga='$cari'")or die(mysql_error());
$no=1;
$hasil=mysql_num_rows($lap);	
$data=mysql_fetch_array($lap);
if ($cari <>$data['nama_warga'])
{
	echo "<script>alert('nama yang anda cari tidak ada');location.href='index.php'</script>";
}
?>
     <div class="col-md-12" >
        <table border="3"  id="table2" cellspacing="0">
            <thead height="40px">
                <th>NO</th>
                <th>NIK</th>
                <th>NO.KK</th>
                <th>NAMA</th>
                <th>JENIS KELAMIN</th>
                <th>TEMPAT LAHIR</th>
                <th>AGAMA</th>
                <th>NO. RUMAH</th>
                <th>NO. HP</th>
                <th>NO. TELEPON</th>
                <th>TANGGAL LAHIR</th>
                <th>PENGHUNI</th>
                <th>ALAMAT</th>
            </thead>
            
            <?php
            include "koneksi.php";
$cari=$_POST['cari'];
$lap=mysql_query("select*from data_warga")or die(mysql_error());
$no=1;
$hasil=mysql_num_rows($lap);	
while ($data=mysql_fetch_array($lap)){
    ?>
            <tbody>
                <tr>
                    <td data-content="No"><?php echo $no;?></td>    
                    <td data-content="NIK"><?php echo $data ['nik'];?></td>    
                    <td data-content="NO.KK"><?php echo $data ['nokk'];?></td>    
                    <td data-content="NAMA"><?php echo $data ['nama'];?></td>    
                    <td data-content="JENIS KELAMIN"><?php echo $data ['kelamin'];?></td>    
                    <td data-content="TEMPAT LAHIR"><?php echo $data ['tempat_lahir'];?></td>      
                    <td data-content="AGAMA"><?php echo $data ['agama'];?></td>        
                    <td data-content="No.RUMAH"><?php echo $data ['no_rumah'];?></td>    
                    <td data-content="No.hp"><?php echo $data ['no_hp'];?></td>    
                    <td data-content="No.telepon"><?php echo $data ['no_tlp'];?></td>    
                    <td data-content="TANGGAL LAHIR"><?php echo $data ['tanggal_lahir'];?>-<?php echo $data ['bulan_lahir'];?>-<?php echo $data ['tahun_lahir'];?></td>          
                    <td data-content="PENGHUNI"><?php echo $data ['penghuni'];?></td>    
                    <td data-content="ALAMAT"><?php echo $data ['alamat'];?></td>    
                </tr>
            </tbody>
            <?php
      $no++;
}
          
    ?>
            
            </table>
        </div>
    
</body>
</html>