<?php $k = 0; //Licznik kolorów na 0 $i = 0; //ustawienie licznika na 0 while($r = mssql_fetch_assoc($result)) { include('kolor.php'); if($r['DADI']<=14){ echo '<td class="backwhitetable"><input type="submit" value="Declare" name="Declare" onclick="window.open(\'declare.php?idec='.$idec.'\', \'Declare\', \'height=350,width=500\');"></td>'; echo '<td class="backwhitetable"><input type="submit" value="SHIP" name="PRINT" onclick="window.open(\'printstick.php?'.$_session['url'].'\', \'Drukuj\', \'height=350,width=500\');"></td>'; } $i++; //licznik + 1 } $count=mssql_num_rows($result); mssql_close($dbhandle); ?>
I dwa przyciski w każdym wierszu (o ile spełniają założenia). - declare i print
Declare przekazuje jawnie w linku wartość idec - i działa dobrze:
echo '<td class="backwhitetable"><input type="submit" value="Declare" name="Declare" onclick="window.open(\'declare.php?idec='.$idec.'\', \'Declare\', \'height=350,width=500\');"></td>';
Natomiast print nie działa dobrze - bo zawsze prezentuje wartość ostatniego wiersza:
echo '<td class="backwhitetable"><input type="submit" value="SHIP" name="PRINT" onclick="window.open(\'printstick.php?'.$_session['url'].'\', \'Drukuj\', \'height=350,width=500\');"></td>';
Jeszcze tutaj plik printstick.php:
<?php require ('sess.php'); require('fpdf.php'); $gt = $_SESSION['url']; include ('connect.php'); include ('query.php'); $pdf=new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',10); $pdf->AddFont('code39','','code39.php'); $result17 = mssql_query($query17); $result16 = mssql_query($query16); $r = mssql_fetch_assoc($result16); $pdf->Cell(50,8,'Zmienna gt: '.$gt,1); $pdf->Ln(8); $pdf->Cell(40,10,''.$_SESSION['nazwa1']); $pdf->Ln(8); $pdf->Cell(80,10,'Part number: '.$r['NR_DET'],1); $pdf->Cell(80,10,'Quantity: '.$r['ILOSC'],1); $pdf->Ln(10); $pdf->Cell(80,10,'Planned date of delivery: '.$r['PLAN_DATA_DOST'],1); $pdf->Cell(80,10,'Supplier code: '.$r['KOD_DOSTAWCY'],1); $pdf->Ln(10); $pdf->Cell(80,10,'Order number: '.$r['NR_ZAMOWIENIA'],1); $pdf->Cell(80,10,'Line number: '.$r['NR_LINII'],1); $pdf->Ln(10); $pdf->Cell(80,10,'Date of delivery: '.$r['DATA_DOST'],1); $pdf->Cell(80,10,'Quantity delivered: '.$r['DATA_DOST'],1); $pdf->Ln(10); $pdf->SetFont('code39','',40); $pdf->Cell(160,22,'*'.$r['CODE'].'*',1,0,'C'); $pdf->Ln(20); $pdf->SetFont('Arial','',8); $pdf->Cell(80,10,'These messages are extremely important for our company.'); $pdf->Ln(6); $pdf->Cell(80,10,'Print this email and publish on the shipment. This will help us work faster.'); $pdf->Output(); include('footer.php'); ?>
Jak można zmienić ten kod aby zaczął działać poprawnie?