$where = "";
$tgl_awal = $_GET['tgl_awal'];
$tgl_akhir = $_GET['tgl_akhir'];
$nama = $_GET['keyw'];
If(!isset($tgl_awal)&&!isset($tgl_akhir)&&!isset($nama)){
$where .="";}
elseif(!isset($nama)){
$where .= " WHERE tanggal BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."' ";}
elseif(!isset($tgl_awal)&&!isset($tgl_akhir)){
$where .= " WHERE nama LIKE '%".$nama."%' ";}
$result = mysql_query("SELECT * FROM absen ".$where."ORDER BY log_absen DESC") or die('Query failed!');
$where = " WHERE 1=1 ";
$tgl_awal = $_GET['tgl_awal'];
$tgl_akhir = $_GET['tgl_akhir'];
$nama = $_GET['keyw'];
if($nama){
$where .= " AND nama LIKE '%".$nama."%'";
}
if($tgl_awal){
$where .= " AND tanggal >= '$tgl_awal'";
}
if($tgl_akhir){
$where .= " AND tanggal <= '$tgl_akhir'";
}
$result = mysql_query("SELECT * FROM absen ".$where."ORDER BY log_absen DESC") or die('Query failed!');
$where = "";
$tgl_awal = $_GET['tgl_awal'];
$tgl_akhir = $_GET['tgl_akhir'];
$nama = $_GET['keyw'];
echo $tgl_awal;echo $tgl_akhir;echo $nama;
If($nama){
$where .=" WHERE nama LIKE '%".$nama."%'";}
elseif($tgl_awal && $tgl_akhir){
$where .= " WHERE tanggal BETWEEN '".$tgl_awal."' AND '".$tgl_akhir."' ";}
else{
$where .= "";}
$result = mysql_query("SELECT * FROM absen ".$where."ORDER BY log_absen DESC") or die('Query failed!');
$where = "";
If(isset($_GET['keyw'])){
$nama = $_GET['keyw'];
$where .= " WHERE nama LIKE '%$nama%' ";}
Elseif(isset($_GET['tgl_awal'])||isset($_GET['tgl_akhir'])){
$tgl_awal= $_GET['tgl_awal'];
$tgl_akhir= $_GET['tgl_akhir'];
$where .= " WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' ";}
else{
$where .= "";}
echo $where;
$flag = false;
$query = "SELECT * FROM absen" .$where."ORDER BY log_absen DESC";
$result = mysql_query($query) or die('Query failed!');
<center><font size="1" face="Arial">export to</font><br><a href="tes_excel4.php?keyw=<?php echo "$nama";?>&tgl_awal=<?php echo '$tgl_awal';?>&tgl_akhir=<?php echo '$tgl_akhir';?>"><img src="image/excel.png"></img></a></center>
$where = " WHERE 1=1 ";
if(isset($_GET['keyw'])){
$nama = $_GET['keyw'];
$where .= " AND nama LIKE '%$nama%' ";
}
if(isset($_GET['tgl_awal'])){
$tgl_awal= $_GET['tgl_awal'];
$where .= " AND tanggal >= '$tgl_awal'";
}
if(isset($_GET['tgl_akhir'])){
$tgl_akhir= $_GET['tgl_akhir'];
$where .= " AND tanggal <= '$tgl_akhir'";
}
echo $where;
$flag = false;
$query = "SELECT * FROM absen" .$where." ORDER BY log_absen DESC";
$result = mysql_query($query) or die('Query failed!');
kemudian di form<center><font size="1" face="Arial">export to</font><br><a href="tes_excel4.php?keyw=<?php echo $nama;?>&tgl_awal=<?php echo $tgl_awal;?>&tgl_akhir=<?php echo $tgl_akhir;?>"><img src="image/excel.png"></img></a></center>