2017-03-22 1 views
0

이것은 내 billingpdf.php입니다. 제출 버튼을 클릭하면 빈 페이지가 생성됩니다. 내가 제거하고 billingpdf.php에 몇 가지 기본 코드를 넣어려고 때 그것은 PDF 파일이 만들어졌으며 내가 입력 한 메시지를 보여줍니다하지만 내가 제출 버튼을 사용하여 시도하면 더 이상 PDF를 생성하지 않는 것 같습니다. 누구 FPDF에서 전문가?빈 페이지 생성 FPDF

<?php 
    session_start(); 
    if (!isset($_SESSION["uemail"])){ 
     header('Location: login.php'); } 
     $uid = $_SESSION['UserID']; 
    ?> 
    <?php 
    if(isset($_POST['submit'])) 
    { 
    require("fpdf.php"); 
    require ("../util/dbConnection.php"); 
    $pdf = new FPDF(); 
    $pdf->AddPage(); 
    $pdf->SetFont('Arial', '', 10); 
    $pdf->Cell(18, 10, '', 0); 
    $pdf->Cell(150, 10, 'Testing"', 0); 
    $pdf->SetFont('Arial', '', 9); 
    $pdf->Cell(50, 10, 'Date: '.date('d-m-Y').'', 0); 
    $pdf->Ln(15); 
    $pdf->SetFont('Arial', 'B', 11); 
    $pdf->Cell(70, 8, '', 0); 
    $pdf->Cell(100, 8, 'Billing Assessment', 0); 
    $pdf->Ln(23); 
    $pdf->SetFont('Arial', 'B', 8); 
    $pdf->Cell(20, 8, 'Expense ID', 0); 
    $pdf->Cell(30, 8, 'Request Booking', 0); 
    $pdf->Cell(20, 8, 'Request Date', 0); 
    $pdf->Cell(20, 8, 'Due date', 0); 
    $pdf->Cell(25, 8, 'Amount', 0); 
    $pdf->Ln(8); 
    $pdf->SetFont('Arial', '', 8); 
    $sql = "SELECT ExpenseID, reqbookID, RequestBooking, requestDate, amount, 
          DATE_ADD(requestDate,INTERVAL 30 DAY) as duedate 
          FROM tblbilling NATURAL JOIN tblbookreq 
          WHERE UserID = $uid ORDER BY requestDate"; 
    $result = $conn->query($sql); 
    while ($row = $result->fetch_assoc()){ 
     $pdf->Cell(20, 8, $row['ExpenseID"'], 0); 
    $pdf->Cell(30, 8, $row['RequestBooking'], 0); 
    $pdf->Cell(20, 8, $row['requestDate'], 0); 
    $pdf->Cell(20, 8, $row['duedate'], 0); 
    $pdf->Cell(25, 8, $row['amount'], 0); 

    } 
    $pdf->Output(); 
    } 
    ?> 
그리고 이것은 내 billing.php

<h2>Services and Charges</h2> 

     <div class="content" style="border:1px dotted black; padding:1%; border-radius:1em; "> 



      <select style="margin-bottom:1%;"> 
       <option> --- </option> 
       <option>Weekly</option> 
       <option>Monthly</option> 
      </select> 
      <select style="margin-bottom:1%;"> 
       <option> --- </option> 
       <option>Laundry</option> 
       <option>Cafe</option> 
       <option>Maintenance</option> 
      </select> 

      <input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for Expenses..."> 

      <table id="myTable" cellpadding=10> 
       <thead> 
        <tr> 
         <th>Expense ID</th> 
         <th>Expense Name</th> 
         <th>Date Requested</th> 
         <th>Date Due</th> 
         <th>Amount</th> 
        </tr> 
       </thead> 
       <input type="submit" value="Print"style="float:right;" ></input> 
       <tbody> 
       </form> 
        <?php 
         include "../util/dbConnection.php"; 
         $sql = "SELECT ExpenseID, reqbookID, RequestBooking, requestDate, amount, DATE_ADD(requestDate,INTERVAL 30 DAY) as duedate FROM tblbilling NATURAL JOIN tblbookreq WHERE UserID = $uid ORDER BY requestDate"; 
         $result = $conn->query($sql); 

         while ($row = $result->fetch_assoc()){ 
          echo "<tr> 
          <td>".$row["ExpenseID"]."</td> 
          <td>".$row["RequestBooking"]."</td> 
          <td>".$row["requestDate"]."</td> 
          <td>".$row["duedate"]."</td> 
          <td>".$row["amount"]."</td> 
          </tr>"; 
         } 
        ?> 

       </tbody> 

      </table> 


     </div> 

답변

0

내가 FPDF 라이브러리를 사용하여 동적 PDF 파일을 생성하기 위해 같은 문제가, 을이 시도하지만 그는 $ PDF-에 의해 해결되었다 > SetAutoPageBreak (false);

 $pdf->AddPage('L','A4'); 
     $pdf->SetFont('Arial','',8); 
     $pdf->SetHeight(4); 
     $pdf->SetAutoPageBreak(false);