我有一个代码,我需要根据外包类型和依赖类型(两者的下拉列表,每个下拉列表)搜索特定数据。有3种类型的外包和4种类型的依赖。当外包id为1和2以及依赖时,我会进行搜索。当用户选择id为1或2的外包时,必须选择依赖项。当外包ID为3时,无需选择依赖,因为除非用户需要查看所有数据,否则无需选择依赖与依赖者一起查看它。但问题是当我选择那种类型的外包时我无法查看数据。它是一个空白页面。
我不知道我的代码在哪里出错:
<form action="prestasioutsource.php" method="post" name="vot">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#333333"><table width="100%" border="0" cellspacing="1" cellpadding="1" class="txtTxt">
<tr bgcolor="#BBFF77">
<td colspan="2" valign="top" bgcolor="#0066CC"><font color="#FFFFFF"><strong>Laporan Prestasi Khidmat Luar</strong></font></td>
</tr>
<tr bgcolor="#BBFF77">
<td width="34%" valign="top" bgcolor="#9BCDFF">Dari Tarikh</td>
<td width="66%" align="LEFT" valign="top" bgcolor="#EFEFEF"><input name="tarikh1" type="text" id="tarikh1" />
<a href="#" onClick="displayDatePicker('tarikh1');"><img src="calender.gif" alt="" width="16" height="16" border="0" /></a>
</td>
</tr>
<tr bgcolor="#BBFF77">
<td width="34%" valign="top" bgcolor="#9BCDFF">Hingga Tarikh</td>
<td width="66%" align="LEFT" valign="top" bgcolor="#EFEFEF"><input name="tarikh2" type="text" id="tarikh2" />
<a href="#" onClick="displayDatePicker('tarikh2');"><img src="calender.gif" alt="" width="16" height="16" border="0" /></a>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#9BCDFF">Jenis Khidmat Luar</td>
<td valign="top" bgcolor="#F8F8F8"><select name="jenis_outsource" class="txtBox" size="1">
<option value="-">--Choose--</option>
<option value="1"> Outsourcing</option>
<option value="2"> Not outsource without charge</option>
<option value="3">All</option>
</select></td>
</tr>
<tr>
<td valign="top" bgcolor="#9BCDFF">Jenis Tanggungan</td>
<td valign="top" bgcolor="#F8F8F8"><select name="jenis_tanggungan" class="txtBox" size="1">
<option value="-">--Choose --</option>
<?
$result = mysql_query("select * from jenis_tangunggan");
while($row = mysql_fetch_object($result))
{
?>
<option value="<?=$row->jenis?>"><?=$row->jenis?></option>
<?
}
?>
</select></td>
</tr>
<tr>
<td colspan="2" valign="top"><div align="center">
<input type="button" name="add" value="Submit" class="cmdButton" onclick="popup('prestasioutsource.php')" />
<input type="reset" name="reset" value="Reset" class="cmdButton" />
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
&#13;
以上是我使用的HTML代码,以下是提交后从上面的代码重定向的下一个代码:
class PDF extends FPDF
{
var $widths;
var $aligns;
function Header()
{
$this->SetLineWidth(0.4);
$this->Line(12,30,287,30);
//Arial bold 15
$this->SetFont('Helvetica','B',15);
//Move to the right
//Title
if($_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_outsource'] == 1 || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_outsource'] == 2 )//from dropdown
{
$sql = "SELECT * FROM outsource ";
$sql.= "WHERE id = '$_GET[jenis_outsource]'";
$query = mysql_query($sql);
$row5 = mysql_fetch_object($query);
$jenis = strtoupper($row5->desc);
$this->Cell(250,10,'LAPORAN PRESTASI ' .strtoupper($row5->desc),'','','C');
$this->Ln(6);
$this->Cell(260,10,' DARI '. $_GET['tarikh1'] .' SEHINGGA '. $_GET['tarikh2'],'','','C');
$this->Ln(6);
}else if($_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'PT' || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'Inden' || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'Interim' || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'PT/Inden' )//from dropdown
{
$sql1 = "SELECT * FROM jenis_tangunggan ";
$sql1.= "WHERE jenis = '$_GET[jenis_tanggungan]'";
$query1 = mysql_query($sql1);
$row6 = mysql_fetch_object($query1);
$jenis1 = strtoupper($row6->desc);
$this->Cell(250,10,'LAPORAN PRESTASI ' .strtoupper($row6->desc),'','','C');
$this->Ln(6);
$this->Cell(260,10,' DARI '. $_GET['tarikh1'] .' SEHINGGA '. $_GET['tarikh2'],'','','C');
$this->Ln(6);
}else {
$this->Cell(250,10,'LAPORAN PRESTASI KESELURUHAN DARI '. $_GET['tarikh1'] .' SEHINGGA '. $_GET['tarikh2'],'','','C');
$this->Ln(6);
}
//Line break
$this->Ln(10);
$this->SetFont('Helvetica','B',7);
$this->SetWidths(array(10,50,20,30,30,30,30,20,30));
$this->SetAligns(array('C','L','C','C','C','C','C','R','C'));
$this->Row(array('Bil','Nama Penerima','Jenis Tanggungan','No Rujukan','Tarikh Bayaran','No Baucar','No Cek','Jumlah','Prestasi'));
}
&#13;
代码的第1部分:
if($_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_outsource'] && $_GET['jenis_tanggungan'])
{
/*********************************************************/
$tarikh = $tarikh[6].$tarikh[7].$tarikh[8].$tarikh[9]."-".$tarikh[3].$tarikh[4]."-".$tarikh[0].$tarikh[1];
$jumlah = 0;
$no = 0;
$tarikh1 = $_GET[tarikh1];
$tarikh2 = $_GET[tarikh2];
$tarikh1 = $tarikh1[6].$tarikh1[7].$tarikh1[8].$tarikh1[9]."-".$tarikh1[3].$tarikh1[4]."-".$tarikh1[0].$tarikh1[1];
$tarikh2 = $tarikh2[6].$tarikh2[7].$tarikh2[8].$tarikh2[9]."-".$tarikh2[3].$tarikh2[4]."-".$tarikh2[0].$tarikh2[1];
$jenis_outsource = $_GET['jenis_outsource'] ;
$jenis_tanggungan = $_GET['jenis_tanggungan'] ;
if($_GET['jenis_outsource'] == 1 || $_GET['jenis_outsource'] == 2) {
$query = " SELECT b.nama_syarikat,a.jenis_tangunggan,e.code_prestasi as prestasi,c.no_pesanan ,c.no_cek,c.tarikh_cek,c.no_baucar,sum(c.amaun) as amaun FROM tangunggan a, transaksi_baucarlo c,penyelenggaraan_syarikat b,prestasi_syarikat e WHERE c.no_pesanan = CONCAT(a.no_tangunggan,'/',a.jb_code,'/',a.tahun) AND a.jenis_outsource = '".$jenis_outsource."' AND a.jenis_tangunggan = '$jenis_tanggungan' AND c.kod_syarikat=b.kod_syarikat AND e.id=c.prestasi and c.bank != '11' AND c.status is NULL AND c.tarikh_cek >= '$tarikh1' AND c.tarikh_cek <= '$tarikh2' GROUP BY c.no_pesanan,c.no_baucar ";
$query .=" ORDER BY tarikh_cek,no_baucar ASC";
$result = mysql_query($query);
$i = 1;
while($row = mysql_fetch_assoc($result))
{
$bil++;
$row_data[] = array($bil,$row['nama_syarikat'],$row['jenis_tangunggan'],$row['no_pesanan'],SQLToDate($row['tarikh_cek']),$row['no_baucar'],$row['no_cek'],number_format($row['amaun'],2),$row['prestasi']);
}
/*********************************************************/
$pdf= new PDF();
$pdf->Open();
$pdf->SetTitle('CARIAN PRESTASI KHIDMAT LUAR');
$pdf->SetMargins(23,35,15);
$pdf->AliasNbPages();
$pdf->AddPage('L');
$pdf->SetFont('Helvetica','',6);
$pdf->SetLineWidth(0.2);
$pdf->SetWidths(array(10,50,20,30,30,30,30,20,30));
$pdf->SetFont('Helvetica','',6);
$pdf->SetAligns(array('C','L','C','C','C','C','C','R','C'));
$pdf->MultiRow($row_data);
$pdf->SetWidths(array(250));
$pdf->SetFont('Helvetica','',6);
$pdf->SetAligns(array(''));
$pdf->Row(array(''));
$pdf->SetWidths(array(220,30));
$pdf->SetFont('Helvetica','B',6);
$pdf->SetAligns(array('R','C'));
$pdf->Row(array('PRESTASI SYARIKAT','JUMLAH'));
$pdf->SetWidths(array(220,30));
$pdf->SetFont('Helvetica','',6);
$pdf->SetAligns(array('R','C'));
$pdf->Row(array('TIDAK MEMUASKAN',$total));
$pdf->Row(array('KURANG BAIK',$total));
$pdf->Row(array('SEDERHANA',$total));
$pdf->Row(array('BAIK',$total));
$pdf->Row(array('SANGAT BAIK',$total));
$pdf->Output();
}
}
?>
&#13;
代码的第二部分。我知道这是一个有点长的代码,但有人可以告诉我它有什么问题吗?我从2天前开始研究它并且我会尝试一切。但结果仍然相同。对不起,代码在某种程度上是马来语。
答案 0 :(得分:0)
尝试将代码更改为:
<!DOCTYPE HTML>
<html>
<body>
<form action="prestasioutsource.php" method="post" name="vot">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#333333"><table width="100%" border="0" cellspacing="1" cellpadding="1" class="txtTxt">
<tr bgcolor="#BBFF77">
<td colspan="2" valign="top" bgcolor="#0066CC"><font color="#FFFFFF"><strong>Laporan Prestasi Khidmat Luar</strong></font></td>
</tr>
<tr bgcolor="#BBFF77">
<td width="34%" valign="top" bgcolor="#9BCDFF">Dari Tarikh</td>
<td width="66%" align="LEFT" valign="top" bgcolor="#EFEFEF"><input name="tarikh1" type="text" id="tarikh1" />
<a href="#" onClick="displayDatePicker('tarikh1');"><img src="calender.gif" alt="" width="16" height="16" border="0" /></a>
</td>
</tr>
<tr bgcolor="#BBFF77">
<td width="34%" valign="top" bgcolor="#9BCDFF">Hingga Tarikh</td>
<td width="66%" align="LEFT" valign="top" bgcolor="#EFEFEF"><input name="tarikh2" type="text" id="tarikh2" />
<a href="#" onClick="displayDatePicker('tarikh2');"><img src="calender.gif" alt="" width="16" height="16" border="0" /></a>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#9BCDFF">Jenis Khidmat Luar</td>
<td valign="top" bgcolor="#F8F8F8"><select name="jenis_outsource" class="txtBox" size="1">
<option value="-">--Choose--</option>
<option value="1"> Outsourcing</option>
<option value="2"> Not outsource without charge</option>
<option value="3">All</option>
</select></td>
</tr>
<tr>
<td valign="top" bgcolor="#9BCDFF">Jenis Tanggungan</td>
<td valign="top" bgcolor="#F8F8F8"><select name="jenis_tanggungan" class="txtBox" size="1">
<option value="-">--Choose --</option>
<?
$result = mysql_query("select * from jenis_tangunggan");
while($row = mysql_fetch_object($result))
{
?>
<option value="<?=$row->jenis?>"><?=$row->jenis?></option>
<?
}
?>
</select></td>
</tr>
<tr>
<td colspan="2" valign="top"><div align="center">
<input type="button" name="add" value="Submit" class="cmdButton" onclick="popup('prestasioutsource.php')" />
<input type="reset" name="reset" value="Reset" class="cmdButton" />
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
&#13;