使用fpdf将显示值传递给pdf

时间:2018-03-09 05:30:54

标签: php pdf fpdf

我想从HTML页面打印显示表。例如,我从哪个ID'中搜索到了什么id'。单击搜索按钮后,将显示包含详细信息的表。我想以PDF格式打印该表。那么,我是否需要在PDF中再次创建表格?

<form class="form-horizontal" action="trypdf.php" method="POST">
        <div class="form-group form-group-sm">

            <label for="inputName" class="control-label col-xs-2" style="margin-left:10%; margin-top:4%; font-size:15px;">Em Part No From:</label>
            <div class="col-xs-3">
                <input type="text" id="srt" name="from" placeholder="From EmPartNo" required="" style="margin-left:-7%; margin-top:18%; text-align:center;"
                value="<?php echo $empartno_pass1;?>"/>         
            </div>
            <div class="col-xs-1">
            <button type="button" name="from" data-toggle="modal" data-target="#search1" data-id="from" style="margin-left:-190%; margin-top:70%;">S</button>
            </div>

            <label for="inputName" class="control-label col-xs-1" style="margin-left:-15%; margin-top:4%; font-size:15px;">To:</label>
            <div class="col-xs-3">
                <input type="text" id="srt2" name="to"  placeholder="To EmPartNo" style="margin-left:-36%; margin-top:18%; text-align:center;"
                value="<?php echo $empartno_pass2;?>"/>
            </div>  

            <div class="col-xs-1">
            <button type="button" name="to" data-toggle="modal" data-target="#search1" data-id="to" style="margin-left:-302%; margin-top:70%;">S</button>
            </div>

            <a href="maintainanceUnit.php"  style="margin-left:85%;">Back to Menu</a>


            <center><input type="submit" value="Search" class="btn btn-primary" style="margin-left:-2%; width:100px; height:30px; text-align:center;"></center><br>


        <table class="table table-bordered table-striped table-hover">
            <thead>
                <tr>
                    <th>EmPartNo</th>
                    <th>Supplier No</th>
                    <th>Supplier Cost</th>
                    <th>Description</th>
                    <th>Foreign Currency</th>
                    <th>Item Cost</th>
                    <th>Admin Cost</th>
                    <th>Cost</th>
                </tr>

            </thead>
            <tbody>
                <tr>
                <?php
                $counter = 1;
                $total = 0;
                if (isset($count) and ($count > 0)) {
                    while($row = mysqli_fetch_assoc($result)){                  
                        $emPartNo = $row['emPartNo'];
                        $supplierPartNo = $row['supplierPartNo'];
                        $supplierCostPrice =$row['supplierCostPrice'];
                        $description = $row['description'];
                        $foreignCurrency =$row['foreignCurrency'];
                        $itemCost = $row['itemCost'];
                        $adminCost =$row['adminCost'];
                        $cost = $row['cost'];
                        echo"<tr>
                        <td>{$row['emPartNo']}</td>
                        <td>{$row['supplierPartNo']}</td>
                        <td align='right'>".number_format($row['supplierCostPrice'],2)."</td>
                        <td>{$row['description']}</td>
                        <td>{$row['foreignCurrency']}</td>
                        <td align='right'>".number_format($row['itemCost'],2)."</td>
                        <td align='right'>".number_format($row['adminCost'],2)."</td>
                        <td align='right'>".number_format($row['cost'],2)."</td>
                        </tr>";
                    }
                    mysqli_free_result($result);
                }
                ?>
                </tr>
            </tbody>
        </table>
    </form>

以下是我想以PDF格式显示的图像示例。

0 个答案:

没有答案