คือ ผมทำการค้นหารายงานแบบเป็น ajax มีการ คิวรี่ข้อมูลใส่ดรอปดาว กับ textbox กดค้นหาแล้วคิวรี่ข้อมูลออกมา 
แล้วสามารถดูตัวอย่างก่อนพิมพ์รายงานได้ ด้วยการดูผ่าน fpdf ต้องทำยังไงครับ ช่วยทีผมอ่อน php จริงๆ
อันนี้เป็นตัวแสดงที่ว่านะครับ 
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้<?
    include "main_head.php";
      include "connect.php";
        $link = ConnectDb();
  mysql_query("SET NAMES UTF8");
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Search</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="js/jqueryui/jquery-ui.css">
    <script src="js/jqueryui/jquery-1.10.2.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jqueryui/jquery-ui.min.js"></script>
    <script src="js/jqueryui/jquery-ui-timepicker-addon.js"></script>
    <script src="js/jqueryui/jquery-ui-sliderAccess.js"></script>
    <script type="text/javascript">
      $( document ).ready(function() {
        $("#date_from").datetimepicker({
            dateFormat: 'yy/mm/dd',
            timeFormat: "HH:mm:ss"
        });
        $("#date_to").datetimepicker({
            dateFormat: 'yy/mm/dd',
            timeFormat: "HH:mm:ss"
        });
        
        // ajax post
        $("input:button").click(function(){
          var data = $("form").serialize();
          $.post(
          'search.php',
          data,
          function(data){
           // $("#information").hide();
            $("#result").html(data).show();
          },
          'html'
          );
        });
        // end ajax post
      });
    </script>
  </head>
  <body>
    <form action="search.php" method="get">
<BR>
<TABLE border='0' align='center' width='1000' height='700' background='images/backgroundPageData.png'>
<TR>
    <TD>
        <TABLE width='990' height='690' align='center' >
        <TR>
            <TD valign='Top'><H3>Rubjang het</H3><BR>
            <TABLE   border='1' align='center' width='600' height='200' >
            <TR>
                                    <!-- DateTimePicker-->
                                        <!doctype html>
                                        <html lang="en">
                                        <body>
                                         
                                        Datefrom <input id="date_from" type="text" name="date_from" class="form-control">
                                        Dateto <input id="date_to" type="text" name="date_to" class="form-control">
                                         
                                         
                                        </body>
                                        </html>
                                
                        Typename  
                        
                                <?php 
                                //Drop down ประเภทเหตุ
                                        $sql="Select SubType_Name From SubType";
                                        $result = mysql_query($sql) or die(mysql_error());
                                        echo"<select Typename>";
                                        while ($row = mysql_fetch_array($result)) {
                                        echo "<option value='" .$row['SubType_Name']."'>".$row['SubType_Name']."</option>";
                                        }
                                        echo    "</select>";
                                        ?>
                                    <br>
                        Stations
                                
                                <?php 
                                //Drop down พื้นที่รับผิดชอบ
                                        $sql2="Select Sta_Name From Stations";
                                        $result2 = mysql_query($sql2) or die(mysql_error()) ;
                                        echo"<select StationName>";
                                        while ($row2 = mysql_fetch_array($result2)) {
                                        echo "<option value='" .$row2['Sta_Name']."'>".$row2['Sta_Name']."</option>";
                                        }
                                        echo    "</select>";
                                        ?>
                                        <br>
                                            <center>    
                                            <input type = "button"  name="OK" value= "Search">
                                            
                                      </form>
                <TD align='center' >
                          <div class="well" id="result">
                  </div>
                  </TD>
            </TR>
            </TABLE>
            </TD>
            </TR>
            </TABLE>        
            </TD>
            </TR>
            </TABLE>
<?
    include "main_footer.php";
?>
<?php
    mysql_close();
?>
    
ตัวนี้ AJAX
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้<?php
    
    // php normal step 1
    $sc = new search(); // create object 
    $sc->find(); // use function find 
    // php oop step 2
    class search {
    // global variables
    var $num;
    var $strSql;
    var $date_from;
    var $date_to;
    var $Station;
    var $Subtype;
    function find(){
        include "connect.php";
        $link = ConnectDb();
          mysql_query("SET NAMES UTF8");
        $this->strSQL = "";
        $this->num = "";
        $this->date_from = $_POST['date_from'];
        $this->date_to = $_POST['date_to'];
        $this->Sta_Name = $_POST['Sta_Name'];
        $this->SubType_Name = $_POST['SubType_Name'];
         
        $this->checkPOST(); // เช็คว่า เลือกอันไหนบ้าง
         $this->checkNum(); // กำหนด คิวรี ตามที่เลือกมา
         
 $objQuery = mysql_query($this->strSQL)  or die(mysql_error());
     
        echo "<tr >
                                    <td align='center'>รหัสแจ้งเหตุ</td>
                                    <td align='center'>วันเวลาแจ้งเหตุ</td>
                                    <td align='center'>ประเภทเหตุ</td>
                                    <td align='center'>ในพื้นที่ ส.ภ.</td>
                                    <td align='center'>รายละเอียดการปิดเหตุ</td>
                                    <td align='center'>เวลาปฎิบัติการ</td>
                                    
                                </tr>";
        $item = "";
        $item .= "<ul>";
        if(mysql_num_rows($objQuery) > 0){
            while ($row = mysql_fetch_array($objQuery)) {
           //     $item .= '<li>'.$row['Ev_ID'].' '.$row['Ev_DateIn'].'  '.$row['SubType_name'].'  '.$row['Sta_name'].'
            //    '.$row['Ev_CloseData'].'  '.$row['Ev_Time'].'</li>';
        
            $Ev_ID=$row[Ev_ID];
            $Ev_DateIn=$row[Ev_DateIn];
            $SubType_name=$row[SubType_name];
            $Sta_name=$row[Sta_name];
            $Ev_CloseData=$row[Ev_CloseData];
            $Ev_Time=$row[Ev_Time];
            
                
            echo "<tr >
                                    <td align='center'>$Ev_ID</td>
                                    <td align='center'>$Ev_DateIn</td>
                                    <td align='center'>$SubType_name</td>
                                    <td align='center'>$Sta_name</td>
                                    <td align='center'>$Ev_CloseData</td>
                                    <td align='center'>$Ev_Time</td>
                                    
                                </tr>";
            }
        }else{
            $item .= "<li>ไม่พบข้อมูล ...</li>";
        }
        $item .= "</ul>";
        
         echo $item;
    }
    function checkNum(){
        $this->strSQL = "select  events.Ev_ID,events.Ev_DateIn,events.Ev_CloseData,events.Ev_Time,subtype.SubType_name,Stations.Sta_name from events inner join subtype  on events.SubType_ID = subtype.SubType_ID
        inner join areaofresponsible on events.Areaof_ID = areaofresponsible.Areaof_ID 
        inner join aumphurofresponsible on areaofresponsible.AumOf_ID = aumphurofresponsible.AumOf_ID 
        inner join stations on aumphurofresponsible.sta_id = stations.sta_id ";
        switch ($this->num) {
            case "1-1-1-1-":
                $this->strSQL .= "WHERE Ev_DateIn >=between '$this->date_from' and Ev_DateIn <= '$this->date_to' ";
                $this->strSQL .= "AND Sta_name = '$this->Sta_Name' AND SubType_name = '$this->SubType_Name' ";
                break;
            case "1-1-1-0-":
                $this->strSQL .= "WHERE Ev_DateIn >= '$this->date_from' Between Ev_DateIn <= '$this->date_to' ";
                $this->strSQL .= "AND Sta_name = '$this->Sta_Name' ";
                break;
            case "1-1-0-1-":
                $this->strSQL .= "WHERE Ev_DateIn >= '$this->date_from' Between Ev_DateIn <= '$this->date_to' ";
                $this->strSQL .= "AND SubType_name = '$this->SubType_Name' ";
                break;
            case "1-1-0-0-":
                $this->strSQL  .= "WHERE Ev_DateIn >= '$this->date_from' Between Ev_DateIn <= '$this->date_to' ";
                break;
            case "1-0-0-0-":
                $this->strSQL  .= "WHERE Ev_DateIn= ''$this->date_from'";
                break;
            case "0-1-0-0-":
                $this->strSQL  .= "WHERE Ev_DateIn = '$this->date_to'";
                break;
            case "0-0-1-1-":
                $this->strSQL  .= "WHERE  Sta_name = '$this->Sta_Name' AND SubType_name = '$this->SubType_Name' ";
                break;
            case "0-1-1-1-":
                $this->strSQL  .= "WHERE events.Ev_DateIn = '$this->date_from' ";
                $this->strSQL  .= "AND stations.Sta_name = '$this->Sta_Name' AND subtypes.SubType_name = '$this->SubType_Name' ";
                break;
            case "1-0-1-1-":
                $this->strSQL  .= "WHERE events.Ev_DateIn = '$this->date_to' ";
                $this->strSQL  .= "AND stations.Sta_name = '$this->Sta_Name' AND subtypes.SubType_name = '$this->SubType_Name' ";
                break;
            default:
                
                break;
        }
    }
    function checkPOST(){
        if(!empty($this->date_from)){
             $this->num .= "1-";
         }else{
             $this->num .= "0-";
         }
         if(!empty($this->date_to)){
             $this->num .= "1-";
         }else{
             $this->num .= "0-";
         }
         if(!empty($this->Sta_Name)){
             $this->num .= "1-";
         }else{
             $this->num .= "0-";
         }
         if(!empty($this->SubType_Name)){
             $this->num .= "1-";
         }else{
             $this->num .= "0-";
         }
    }
}
?>
 fpdf ที่ร่างแบบไว้ 
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้<?php
require("fpdf17/fpdf.php");
$pdf = new FPDF();
//var_dump(get_class_methods($pdf));
$pdf->AddPage();
$pdf->AddFont('angsana','','angsa.php');
$pdf->SetFont("angsana",'',"20");
$pdf->Cell(0,10,"วันที่พิมพ์ :",10,1);
$date=date("d/m/Y"); 
$pdf->Cell(0,10,"$date",10,1);
$pdf->SetFont("angsana",'',"25");
$pdf->Cell(0,10,"รายงานแจ้งเหตุ",10,1,"C");
$pdf->SetFont("angsana",'',"18");
$pdf->Cell(0,10,"ประจำวันที่  ถึง",10,1,"C");
$pdf->SetFont("angsana",'',"18");
$pdf->Cell(0,10,"หน่วยงานรับผิดชอบ",10,1,"C");
$pdf->SetFont("angsana",'',"18");
$pdf->Cell(0,10,"----------------------------------------------------------------------------------------------------------",10,1,"C");
/// แสดงข้อมูลในนี้
$pdf->SetFont("angsana",'',"18");
$pdf->Cell(0,10,"----------------------------------------------------------------------------------------------------------",10,1,"C");
$pdf->SetFont("angsana",'',"18");
$pdf->Cell(0,10,"ผู้จัดทำ",10,1,"R");
$pdf->Output("");
?>
																															 
						
php fpdf + ajax ช่วยทีครับ
แล้วสามารถดูตัวอย่างก่อนพิมพ์รายงานได้ ด้วยการดูผ่าน fpdf ต้องทำยังไงครับ ช่วยทีผมอ่อน php จริงๆ
อันนี้เป็นตัวแสดงที่ว่านะครับ [Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
ตัวนี้ AJAX[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
fpdf ที่ร่างแบบไว้ [Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้