kalau kta ingin menampilkan data perkelas gimana gan,,,
misalnya kita buat combobox dan didalam kombobox tersebuat ada pilihan kelas ketika kita pilih kelas X maka akan tampil semua data siswa yang ada di kelas X tersebut
ini scrift nya
<?php
include "include/koneksi.php";
include "include/setting.php";
//Apabila klik cari
if(isset($_POST['cari'])) {
$cnis=$_POST['cnis'];
$carix = "select * from tblsiswa where nis='$cnis'";
$cari=mysql_query($carix);
if($cari){
header("location:tampil_siswa.php?nis=$cnis");
}
}
?>
<HTML>
<HEAD><TITLE><?php echo"$judul";?></TITLE>
<link rel="stylesheet" href="css/style.css" type="text/css">
<script type="text/javascript" src="jquery/jquery.js"></script>
<style type="text/css">
<!--
.style4 {color: #FF3300}
-->
</style>
</head>
<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff">
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="83%">
<tr>
<td width="50%" background="gambar/bg.gif"><img src="gambar/px1.gif" width="1" height="1" alt="" border="0"></td>
<td valign="bottom" background="gambar/bg_left.gif"><img src="gambar/bg_left.gif" alt="" width="17" height="16" border="0"></td>
<td><table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?php include "header.php"; ?></td>
</tr>
<tr>
<td>
<?php include "menu_atas.php"; ?></td>
</tr>
<tr>
<td background="gambar/fon_top.jpg"><p>
</td>
</tr>
</table>
<table width="774" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="115" valign="top"><p>
<?php include "menu_kiri.php"; ?>
</p> </td>
<td valign="top"><h2 align="center"><strong>Data Siswa </strong></h2>
<form id="form2" name="form2" method="post" action="">
<table width="210" border="0" align="center" cellpadding="1" cellspacing="0">
<tr>
<td width="50"><div align="center"><img src="gambar/search.gif" width="50" height="50" /></div></td>
<td width="180"><input name="cnis" type="text" id="cnis" size="10" />
<input name="cari" type="submit" id="cari" value="Cari" /></td>
</tr>
<tr>
<td>Plih Kelas</td>
<td>
<select title="kelas" name="id_kelas" id="id_kelas" onChange="kelas(id_kelas.value)">
<option value="0" selected="selected">Pilih Kelas</option>
<?
include "include/koneksi.php";
$query=mysql_db_query($db,"select * from tblsiswa",$koneksi);
while($row=mysql_fetch_array($query))
{
?><option value="<? echo $row['id_kelas']; ?>"><? echo $row['kelas']; ?></option><?
}
?>
</select>
</td>
</tr>
</table>
</form>
<table width="509" border="1" align="center" cellpadding="1" cellspacing="0">
<tr valign="top">
<td width="83"><div align="center"><strong>NIS</strong></div></td>
<td width="120"><div align="center"><strong>Nama Siswa</strong></div></td>
<td width="84"><div align="center"><strong>Jenis Kelamin</strong></div></td>
<td width="68"><div align="center"><strong>Kelas</strong></div></td>
<td width="52"><div align="center"><strong>Detail</strong></div></td>
</tr>
</tr></table>
<p> </p>
<td width="81" valign="top" bgcolor="#FFFFFF"><?php include "menu_kanan.php"; ?></td>
</tr>
</table>
<div class="px" align="center"><img src="gambar/bot01.jpg" width="845" height="9" alt="" border="0"></div>
<table border="0" cellspacing="0" cellpadding="0" width="780" align="center">
<tr>
<td><p align="center">
<?php include "footer.php"; ?>
</p></td>
<td height="50">
<p class="bot"> </p>
</td>
</tr>
</table>
</td>
<td valign="bottom" background="gambar/bg_right.gif"><img src="gambar/bg_right.gif" alt="" width="17" height="16" border="0"></td>
<td width="50%" background="gambar/bg.gif"><img src="gambar/px1.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>
</body>
</html>
ini table siswa nya
CREATE TABLE IF NOT EXISTS `tblsiswa` (
`nis` varchar(10) NOT NULL,
`nama_siswa` varchar(35) NOT NULL,
`tempat_lahir` varchar(35) NOT NULL,
`tgl_lahir` date NOT NULL,
`alamat` text NOT NULL,
`kelas` varchar(10) NOT NULL,
`semester` int(1) NOT NULL,
`jenis_kelamin` varchar(15) NOT NULL,
`agama` varchar(20) NOT NULL,
`foto` varchar(40) NOT NULL,
PRIMARY KEY (`nis`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data untuk tabel `tblsiswa`
--
INSERT INTO `tblsiswa` (`nis`, `nama_siswa`, `tempat_lahir`, `tgl_lahir`, `alamat`, `kelas`, `semester`, `jenis_kelamin`, `agama`, `foto`) VALUES
('10101', 'adies', 'bkj', '1990-04-02', 'tkn', 'X', 1, 'Laki-Laki', 'Islam', 'q.jpg'),
('2011001', 'M. Faris Azmi', 'Dasan Baru Kesik', '1995-02-01', 'Dasan Baru Kesik, Masbagik Lombok Timur', 'X', 1, 'Laki-Laki', 'Islam', 'a.jpg'),
('2011002', 'Alicia', 'Mataram', '1977-02-02', 'Dasan Agung Mataram', 'X', 1, 'Perempuan', 'Islam', 'q.jpg'),
('2011003', 'Irvan Bachdim', 'Jakarta', '1994-02-01', 'Jakarta Utara', 'XII', 1, 'Laki-Laki', 'Islam', '1bachdim.jpg'),
('2011004', 'Siti Aminah', 'Praya', '1994-06-17', 'Praya Lombok Tengah', 'XI', 2, 'Perempuan', 'Islam', 'foto3.jpg'),
('2011005', 'Eko Patrio', 'Selong', '1996-08-02', 'Selong Lombok Timur', 'XI', 2, 'Laki-Laki', 'Islam', '17mark_zuckerberg.jpg'),
('2011006', 'Ayu Ningsih', 'Gomong', '1994-04-05', 'Gomong Lama Mataram', 'XI', 2, 'Perempuan', 'Islam', 'alicia4.jpg'),
('2011007', 'Evi Tamala', 'Gerung', '1995-12-02', 'Gerung Lombok Barat', 'X', 2, 'Perempuan', 'Islam', 'campbells.jpg'),
('2011008', 'Luna Maya', 'Mataram', '1994-10-05', 'Ampenan Mataram', 'XI', 2, 'Perempuan', 'Islam', 'lunamaya2.jpg'),
('2011009', 'Putri Maharani', 'Masbagik', '1993-01-09', 'Masbagik Lombok Timur', 'XI', 2, 'Perempuan', 'Islam', 'foto4.jpg');