mas...data nya ga mw nampil,data not found ... mhon bantuan koreksinya,
file caridata.php
<form id="form1" name="form1" method="get" action="tampilcari.php">
Tahun
<select name="tahun">
<?php
$mulai= date('Y') - 50;
for($i = $mulai;$i<$mulai + 100;$i++){
$sel = $i == date('Y') ? ' selected="selected"' : '';
echo '<option value="'.$i.'"'.$sel.'>'.$i.'</option>';
}
?>
</select>
<input type="text" name="kd_keahlian" id="kd_keahlian" />
<input type="submit" name="button" id="button" value="Submit" />
</form>
file tampilcari.php
<?php (require"konek.php");?>
<? $tanggal= $_POST['tanggal'];
$tahun = $_POST['tahun'];
$sql = "SELECT calon_siswa.no_daftar,calon_siswa.namalengkap,calon_siswa.tempatlahir,calon_siswa.tgllahir,calon_siswa.jk,calon_siswa.agama,calon_siswa.asalsekolah,calon_siswa.alamat,calon_siswa.namaortu,calon_siswa.pekerjaanortu,keahlian.nm_keahlian,keahlian.kd_keahlian,calon_siswa.tanggal FROM calon_siswa INNER JOIN keahlian ON calon_siswa.kd_keahlian = keahlian.kd_keahlian
WHERE keahlian.kd_keahlian and year(calon_siswa.tanggal) = '$tahun'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0){
?>
</p>
<p><strong>Data Di Temukan</strong></p>
<table border="1" align="left">
<tr>
<td width="57" bgcolor="#CCCCCC" >Kode Keahlian</td>
<td width="125" bgcolor="#CCCCCC" >Pilihan Keahlian</td>
<td width="67" bgcolor="#CCCCCC" >No daftar</td>
<td width="86" bgcolor="#CCCCCC" >Nama Lengkap</td>
<td width="90" bgcolor="#CCCCCC" >Tempat/Tgl Lahir</td>
<td width="25" bgcolor="#CCCCCC" >JK</td>
<td width="88" bgcolor="#CCCCCC" >Alamat</td>
<td width="125" bgcolor="#CCCCCC" >Asal Sekolah</td>
<td width="122" bgcolor="#CCCCCC" >Nama Ortu</td>
<td width="83" bgcolor="#CCCCCC" >Pekerjaan ortu</td>
<td width="104" bgcolor="#CCCCCC" >Tanggal daftar</td>
<td colspan="2" align="center" bgcolor="#CCCCCC">Aksi</td>
</tr>
<?php
while($data = mysql_fetch_array($result)){?>
<tr>
<td><?php echo $data['kd_keahlian'];?></td>
<td><?php echo $data['nm_keahlian'];?></td>
<td><?php echo $data['no_daftar'];?></td>
<td><?php echo $data['namalengkap'];?></td>
<td><?php echo $data['tempatlahir'];?>, <?php echo $data['tgllahir'];?></td>
<td><?php echo $data['jk'];?></td>
<td><?php echo $data['alamat'];?></td>
<td><?php echo $data['asalsekolah'];?></td>
<td><?php echo $data['namaortu'];?></td>
<td><?php echo $data['pekerjaanortu'];?></td>
<td><?php echo $data['tanggal'];?></td>
<td width="84" style="border-bottom:1px solid #000"><?php echo "<a href='edit.php?id=$data[no_daftar]'>Edit</a>"; ?> </td>
<td width="84" style="border-bottom:1px solid #000"> </td>
</tr>
<?php }?>
</table>
<?php
}else{
echo 'Data not found!';
}
?>
</td>
</tr>
<tr>
</tr>
</table>
</body>
</html>