i'm not good enough at english and PHP. So I have a question: How to get result by 'GET' request? i have an url like this:
laporanpemesanancetak.php?TANGGAL_PERIODE1=2016-05-01&TANGGAL_PERIODE2=2016-05-23
and my GET method like:
if (isset($_GET["$TANGGAL_PERIODE1"])) {
$TANGGAL_PERIODE1 = $_GET["TANGGAL_PERIODE1"];
$TANGGAL_PERIODE2 = $_GET["TANGGAL_PERIODE2"];
$query = mysql_query("select p.PURCHASE_ORDER_PEMESANAN,p.TANGGAL_PEMESANAN,s.NAMA_SUPPLIER,i.NAMA_BAHAN_BAKU,p.JUMLAH_PEMESANAN,i.SATUAN,k.NAMA_KARYAWAN
from pemesanan p,supplier s,inventori i,karyawan k
where p.NPWP_SUPPLIER = s.NPWP_SUPPLIER and p.ID_BAHAN_BAKU = i.ID_BAHAN_BAKU and p.NIP_KARYAWAN = k.NIP_KARYAWAN and p.TANGGAL_PEMESANAN between '$TANGGAL_PERIODE1' and '$TANGGAL_PERIODE2' order by p.PURCHASE_ORDER_PEMESANAN");
while ($row = mysql_fetch_array($query)) {
$pdf->Cell(27,8,$row["PURCHASE_ORDER_PEMESANAN"],1,0,"C");
$pdf->Cell(27,8,$row["TANGGAL_PEMESANAN"],1,0,"C");
$pdf->Cell(27,8,$row["NAMA_SUPPLIER"],1,0,"C");
$pdf->Cell(27,8,$row["NAMA_BAHAN_BAKU"],1,0,"C");
$pdf->Cell(27,8,$row["JUMLAH_PEMESANAN"],1,0,"C");
$pdf->Cell(27,8,$row["SATUAN"],1,0,"C");
$pdf->Cell(27,8,$row["NAMA_KARYAWAN"],1,0,"C");
$pdf->Ln();
}
}
and the result is show nothing, i've tried using
if (isset($_GET["$TANGGAL_PERIODE1"])&&$_GET["$TANGGAL_PERIODE2"])
but the result is same, i've tried my sql query into mysql and it works.
Can someone help me please? it would be great :)
$_GET["$TANGGAL_PERIODE1"]
Note the $
in the key. This will try to evaluate the variable $TANGAL_PERIODE1
rather than look a key of the $_GET array named TANGAL_PERIODE1
Be sure to not ignore E_NOTICE and E_WARNING messages when developing. These are important clues, this would generate a notice of an undefined variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.