Dears,
I have script like this...
<?php
include_once "library/inc.sesadmin.php";
include_once "library/inc.library.php";
# Filter Terpilih
$dataTahun = isset($_POST['cmbTahun']) ? $_POST['cmbTahun'] : date('Y');
$dataBulan = isset($_POST['cmbBulan']) ? $_POST['cmbBulan'] : date('m');
# TMBOL CETAK DIKLIK
if (isset($_POST['btnCetak'])) {
// Buka file
echo "<script>";
echo "window.open('cetak/periksa.php?bulan=$dataBulan&tahun=$dataTahun')";
echo "</script>";
}
# UNTUK PAGING (PEMBAGIAN HALAMAN)
$lim = 50;
$hal = isset($_GET['hal']) ? $_GET['hal'] : 0;
$pageSql = "SELECT * FROM periksa WHERE LEFT(tgl_periksa,4)='$dataTahun' AND MID(tgl_periksa,6,2)='$dataBulan'";
$pageQry = mysql_query($pageSql, $koneksidb) or die ("error paging: ".mysql_error());
$jml = mysql_num_rows($pageQry);
$max = ceil($jml/$lim);
?>
<h2> DAFTAR PERIKSA </h2>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" name="form1" target="_self">
<table width="500" border="0" class="table-list">
<tr>
<td colspan="3" bgcolor="#CCCCCC"><strong>FILTER DATA </strong></td>
</tr>
<tr>
<td width="105"><strong>Periode Periksa </strong></td>
<td width="5"><strong>:</strong></td>
<td width="376">
<select name="cmbBulan">
<?php
$listBulan = array("01" => "Januari", "02" => "Februari", "03" => "Maret",
"04" => "April", "05" => "Mei", "06" => "Juni", "07" => "Juli",
"08" => "Agustus", "09" => "September", "10" => "Oktober",
"11" => "November", "12" => "Desember");
foreach($listBulan as $bulanke => $bulannm) {
if ($bulanke == $dataBulan) {
$cek = " selected";
} else { $cek=""; }
echo "<option value='$bulanke' $cek>$bulannm</option>";
}
?>
</select>
<select name="cmbTahun">
<?php
# Baca tahun terendah(awal) di tabel Transaksi
$thnSql = "SELECT MIN(LEFT(tgl_periksa,4)) As tahun FROM periksa";
$thnQry = mysql_query($thnSql, $koneksidb) or die ("Error".mysql_error());
$thnRow = mysql_fetch_array($thnQry);
$thnTerkecil = $thnRow['tahun'];
for($thn= $thnTerkecil; $thn <= date('Y'); $thn++) {
if ($thn == $dataTahun) {
$cek = " selected";
} else { $cek=""; }
echo "<option value='$thn' $cek>$thn</option>";
}
?>
</select>
<select name="cmbDokter">
<option value="BLANK"> </option>
<?php
$dokterSql = "SELECT dokter.kd_dokter, dokter.nm_dokter,data_spesialis.nm_spesialis FROM data_spesialis, dokter
WHERE data_spesialis.kd_spesialis=dokter.kd_spesialis ORDER BY kd_dokter";
$dokterQry = mysql_query($dokterSql, $koneksidb) or die ("Gagal Query".mysql_error());
while ($dokterRow = mysql_fetch_array($dokterQry)) {
if ($dokterRow['kd_dokter']== $_POST['cmbDokter']) {
$cek = " selected";
} else { $cek=""; }
echo "<option value='$dokterRow[kd_dokter]' $cek>$dokterRow[nm_dokter] ( $dokterRow[nm_spesialis] )</option>";
}
$sqlData ="";
?>
</select>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input name="btnTampil" type="submit" value=" Tampilkan " />
<input name="btnCetak" type="submit" value=" Cetak " /></td>
</tr>
</table>
</form>
<table class="table-list" width="800" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="23" align="center" bgcolor="#CCCCCC"><strong>No</strong></td>
<td width="80" align="center" bgcolor="#CCCCCC"><strong>No Periksa </strong></td>
<td width="80" align="center" bgcolor="#CCCCCC"><strong>Tanggal </strong></td>
<td width="85" align="center" bgcolor="#CCCCCC"><strong>Kode Pasien </strong></td>
<td width="134" bgcolor="#CCCCCC"><strong>Nama Pasien </strong></td>
<td width="133" bgcolor="#CCCCCC"><strong>Dokter</strong></td>
<td width="229" bgcolor="#CCCCCC"><strong>Hasil Diagnosa </strong></td>
</tr>
<?php
# Tampilkan data pasien, SQL-nya ada di halaman atas
$mySql = "SELECT periksa.*, pasien.nama, dokter.nm_dokter
FROM periksa, pasien, dokter
WHERE periksa.kd_pasien=pasien.kd_pasien AND periksa.kd_dokter=dokter.kd_dokter
AND LEFT(tgl_periksa,4)='$dataTahun' AND MID(tgl_periksa,6,2)='$dataBulan'
ORDER BY (SUBSTR(periksa.no_periksa,6) + 0) DESC LIMIT $hal, $lim";
$myQry = mysql_query($mySql, $koneksidb) or die ("Query periksa salah : ".mysql_error());
$nomor = 0;
while ($myData = mysql_fetch_array($myQry)) {
$nomor++;
// gradasi warna
if($nomor%2==1) { $warna=""; } else {$warna="#F5F5F5";}
?>
<tr bgcolor="<?php echo $warna; ?>">
<td align="center"><?php echo $nomor; ?></td>
<td align="center"><b><?php echo $myData['no_periksa']; ?></b></td>
<td align="center"><?php echo IndonesiaTgl($myData['tgl_periksa']); ?></td>
<td align="center"><b><?php echo $myData['kd_pasien']; ?></b></td>
<td><?php echo $myData['nama']; ?></td>
<td><?php echo $myData['nm_dokter']; ?></td>
<td><?php echo $myData['diagnosa_penyakit']; ?></td>
</tr>
<?php } ?>
<tr>
<td colspan="5"><b>Jumlah Data :</b> <?php echo $jml; ?> </td>
<td colspan="2" align="right"><b>Halaman ke :</b>
<?php
for ($h = 1; $h <= $max; $h++) {
$list[$h] = $lim * $h - $lim;
echo " <a href='?page=Daftar-Periksa&hal=$list[$h]'>$h</a> ";
}
?></td>
</tr>
</table>
<a href="cetak/periksa.php?bulan=<?php echo $dataBulan; ?>&tahun=<?php echo $dataTahun; ?>" target="_blank"><img src="images/btn_print2.png" height="18" border="0" title="Cetak ke Format HTML"/></a>
and the question is.... I try to make filter for Dokter, and when i choose the dokter and month and years, why it can not show..is there any wrong with my script?