Tolong plis... ini aku kirimin script PHP tuk buat report.. masih error.. tolong dibantu donk...
<?php
//Laporan.php
session_start();
if (empty($_SESSION['username']) AND empty($_SESSION['passuser']))
{
echo "<link href='style.css' rel='stylesheet' type='text/css'>
<center>Untuk mengakses modul, Anda harus login <br>";
echo "<a href=../../index.php><b>LOGIN</b></a></center>";
}
else{
$aksi="modul/mod_laporan/aksi_laporan.php";
switch($_GET[act])
{
default:
echo "<h2>Laporan Data Siswa</h2>
<form method=get action='$_SERVER[PHP_SELF]'>
<input type=hidden name=module value=laporan>
<div id=paging>Masukkan Tahun Pendaftaran : ";
combothn(2000,$thn_sekarang,'kata',$thn_sekarang);
echo "<input type=submit value=Generate>
<p><a href=ctk_laporan2.php><img src='images/print.png' border=0 title=Print></a></p>
</div></form>" ;
//<input type=button value='Tambah Pendaftaran' onclick=\"window.location.href='?module=daftar&act=tambahdaftar';\">";
if (empty($_GET['kata']))
{
echo "<table>
<tr><th>no</th><th>tgl. daftar</th><th>nama siswa</th><th>tgl. lahir</th><th>kelas</th><th>jenkel</th><th>status </th><th>agama</th><th>alamat</th><th>wali</th><th>gambar</th></tr>";
$p = new Paging;
$batas = 5;
$posisi = $p->cariPosisi($batas);
$tampil=mysql_query("SELECT * FROM daftar,kelas,jenkel,status,agama
WHERE kelas.id_kelas=daftar.id_kelas
AND jenkel.id_jenkel=daftar.id_jenkel
AND status.id_status=daftar.id_status
AND agama.id_agama=daftar.id_agama
ORDER BY id_daftar DESC LIMIT $posisi,$batas");
$no = $posisi+1;
while($r=mysql_fetch_array($tampil))
{
$tgl_lahir = tgl_indo($r[tgl_lahir]);
$tgl_daftar = tgl_indo($r[tgl_daftar]);
echo "<tr><td>$no</td>
<td>$tgl_daftar</td>
<td>$r[nama_siswa]</td>
<td>$tgl_lahir</td>
<td>$r[nama_kelas]</td>
<td>$r[nama_jenkel]</td>
<td>$r[nama_status]</td>
<td>$r[nama_agama]</td>
<td>$r[alamat]</td>
<td>$r[wali]</td>
<td align=center><img src='../foto_siswa/small_$r[gambar]'></td>
</tr>";
$no++;
}
echo "</table>";
$jmldata = mysql_num_rows(mysql_query("SELECT * FROM daftar"));
$jmlhalaman = $p->jumlahHalaman($jmldata, $batas);
$linkHalaman = $p->navHalaman($_GET[halaman], $jmlhalaman);
echo "<div id=paging>$linkHalaman</div><br>";
break;
}
// akhir if 1
else
{
echo "<table>
<tr><th>no</th><th>tgl. daftar</th><th>nama siswa</th><th>tgl. lahir</th><th>kelas</th><th>jenkel</th><th>status</th><th>agama</th><th>alamat</th><th>wali</th><th>gambar</th></tr>";
$p = new Paging;
$batas = 15;
$posisi = $p->cariPosisi($batas);
$tampil=mysql_query("SELECT * FROM daftar,kelas,jenkel,status,agama
WHERE YEAR(tgl_daftar) LIKE '%$_GET[kata]%'
AND kelas.id_kelas=daftar.id_kelas
AND jenkel.id_jenkel=daftar.id_jenkel
AND status.id_status=daftar.id_status
AND agama.id_agama=daftar.id_agama
ORDER BY id_daftar DESC LIMIT $posisi,$batas");
$no = $posisi+1;
while($r=mysql_fetch_array($tampil))
{
$tgl_lahir = tgl_indo($r[tgl_lahir]);
$tgl_daftar = tgl_indo($r[tgl_daftar]);
echo "<tr><td>$no</td>
<td>$tgl_daftar</td>
<td>$r[nama_siswa]</td>
<td>$tgl_lahir</td>
<td>$r[nama_kelas]</td>
<td>$r[nama_jenkel]</td>
<td>$r[nama_status]</td>
<td>$r[nama_agama]</td>
<td>$r[alamat]</td>
<td>$r[wali]</td>
<td align=center><img src='../foto_siswa/small_$r[gambar]'></td>
</tr>";
$no++;
}
echo "</table>";
break;
}
//akhir if 2
case "tambahdaftar":
break ;
case "editdaftar":
break;
}
}
?>
<?php
//ctk_laporan.php
session_start();
//koneksi ke database
include "../config/koneksi.php";
//include "modul/mod_laporan/laporan.php";
//akhir koneksi
//include "fpdf.php";
#sertakan library FPDF dan bentuk objek
require_once ("fpdf/fpdf.php");
//require_once ("modul/mod_laporan/laporan.php");
$tgl = date('d-M-Y');
$pdf = new FPDF('L');
$pdf->Open();
$pdf->addPage();
$pdf->setAutoPageBreak(false);
$pdf->setFont('Arial','',12);
$pdf->text(10,30,'RA. BINA MUJTAMA');
$pdf->text(10,36,'INFORMASI DATA SISWA');
$yi = 50;
$ya = 44;
$row = 6;
$pdf->setFont('Arial','',9);
$pdf->setFillColor(222,222,222);
$pdf->setXY(10,$ya);
$pdf->CELL(6,6,'NO',1,0,'C',1);
$pdf->CELL(20,6,'Tgl Daftar',1,0,'C',1);
$pdf->CELL(30,6,'Nama Mahasiswa',1,0,'C',1);
$pdf->CELL(20,6,'Tgl Lahir',1,0,'C',1);
$pdf->CELL(15,6,'Kelas',1,0,'C',1);
$pdf->CELL(20,6,'Jenis Kelamin',1,0,'C',1);
$pdf->CELL(20,6,'Status',1,0,'C',1);
$pdf->CELL(20,6,'Agama',1,0,'C',1);
$pdf->CELL(75,6,'Alamat',1,0,'C',1);
$pdf->CELL(47,6,'Wali',1,0,'C',1);
//$pdf->CELL(30,6,'Foto',1,0,'C',1);
//$tahun = $_GET['kata'] ;
$ya = $yi + $row;
$sql = mysql_query("SELECT * FROM daftar,kelas,jenkel,status,agama
WHERE MONTH(tgl_daftar) = '%$_GET[$kata]%'
AND kelas.id_kelas=daftar.id_kelas
AND jenkel.id_jenkel=daftar.id_jenkel
AND status.id_status=daftar.id_status
AND agama.id_agama=daftar.id_agama
ORDER BY id_daftar ");
$i = 1;
$no = 1;
$max = 31;
$row = 6;
while($data = mysql_fetch_array($sql)){
$pdf->setXY(10,$ya);
$pdf->setFont('arial','',9);
$pdf->setFillColor(255,255,255);
$pdf->cell(6,6,$no,1,0,'C',1);
$pdf->cell(20,6,$data['tgl_daftar'],1,0,'L',1);
$pdf->cell(30,6,$data['nama_siswa'],1,0,'L',1);
$pdf->CELL(20,6,$data['tgl_lahir'],1,0,'L',1);
$pdf->CELL(15,6,$data['nama_kelas'],1,0,'L',1);
$pdf->CELL(20,6,$data['nama_jenkel'],1,0,'L',1);
$pdf->CELL(20,6,$data['nama_status'],1,0,'L',1);
$pdf->CELL(20,6,$data['nama_agama'],1,0,'C',1);
$pdf->CELL(75,6,$data['alamat'],1,0,'L',1);
$pdf->CELL(47,6,$data['wali'],1,0,'L',1);
//$pdf->CELL(30,6,$data['gambar'],1,0,'C',1);
$ya = $ya+$row;
$no++;
$i++;
//$dm[kode] = $data[id_daftar];
}
$pdf->text(200,$ya+6,"Jakarta , ".$tgl);
$pdf->text(200,$ya+24,"(Nama Jelas)");
$pdf->output();
?>
Itu masih ada error,, yang aku tanyain,, gimana cara ambil variabel 'KATA' yang diinput dari laporan.php biar bisa digunain di ctk_laporan.php (di QUERY nya)..
Plizzzz