Tampil Data Php membuat Pencarian Menggunakan List
Selamat Siang dan salam sejahtera di siang ini sambil mengulas tentang Tugas akhir sya ingin share pengetahuan tentang Php .
Demikian cara menampilakan data dan pencarian nya langsung
- Buat Table Pencarian
<table width="1072" height="134" border="1" align="center" class="bordered">
<tr>
<th colspan="9" scope="col"><div align="center">Data Pemagang</div></th>
</tr>
<tr>
<td colspan="9"><table width="910" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="132"> <div align="left">Tahun Masuk </div></td><td width="137"><label>
<select name="cari_data" id="cari_data">
<option>[Pilih Tahun]</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
</select>
</label></td>
<td width="641"><label>
<input type="submit" name="Submit" value="cari" />
</label></td>
</tr>
</table>
<tr>
<th colspan="9" scope="col"><div align="center">Data Pemagang</div></th>
</tr>
<tr>
<td colspan="9"><table width="910" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="132"> <div align="left">Tahun Masuk </div></td><td width="137"><label>
<select name="cari_data" id="cari_data">
<option>[Pilih Tahun]</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
</select>
</label></td>
<td width="641"><label>
<input type="submit" name="Submit" value="cari" />
</label></td>
</tr>
</table>
2. Buat Script Seperti di bawah ini sesuaikan table yang anda gunakan
<?php
include '../temp/connection.php';
$no = 1;
$pilih = mysql_query("SELECT * FROM tbl_pemagang WHERE thn LIKE '%$_POST[cari_data]%'");
while($data = mysql_fetch_array($pilih))
{
?>
include '../temp/connection.php';
$no = 1;
$pilih = mysql_query("SELECT * FROM tbl_pemagang WHERE thn LIKE '%$_POST[cari_data]%'");
while($data = mysql_fetch_array($pilih))
{
?>
3. Tampilkan data-data yang ingin anda
<td><?= $no ?></td>
<td><?=$data[no_peserta]?></td>
<td><?=$data[nm_peserta]?></td>
<td><?=$data[jekel]?></td>
<td><?=$data[pendidikan]?></td>
<td><?=$data[thn]?></td>
<td><?=$data[alamat]?></td>
<td><?=$data[telp]?></td>
<td><?=$data[keterampilan]?></td>
Download Scrip
<td><?=$data[no_peserta]?></td>
<td><?=$data[nm_peserta]?></td>
<td><?=$data[jekel]?></td>
<td><?=$data[pendidikan]?></td>
<td><?=$data[thn]?></td>
<td><?=$data[alamat]?></td>
<td><?=$data[telp]?></td>
<td><?=$data[keterampilan]?></td>
Posting Komentar