$sql="Select * From $tb";
$cond="";
if ($txtmonth <> "00")
if($cond=="")
$cond=" where send_date like \"%/".$txtmonth."/%\"";
else
$cond.=" and send_date like \"%/".$txtmonth."/%\"";
if($txtserial<>"")
if($cond=="")
$cond=" where serial='".$txtserial."'";
else
$cond.=" and serial='".$txtserial."'";
if ($txtunit <> "all")
if($cond=="")
$cond=" where unit_name='".$txtunit."'";
else
$cond.=" and unit_name='".$txtunit."'";
if ($txttype <> "all")
if($cond=="")
$cond=" where type='".$txttype."'";
else
$cond.=" and type='".$txttype."'";
$sql.=$cond;