【发布时间】:2012-04-16 12:50:33
【问题描述】:
我有以下 php 表,如何将打印功能添加到 php 表中?还有一个按钮,当单击时,下表通过打印机打印,我尝试了“CTRL+P”,我只得到了页面示例的 html 部分页眉、页脚、导航栏,而不是结果 php 结果
<?php
echo "<table border='1' id= results>
<tr>
<th>FILEID</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Issue Date</th>
<th>Interest Rate</th>
<th>Terms</th>
<th>Balance Outstanding</th>
<th>Balance Outstanding</th>
<th>New Loan</th>
<th>Principal Repayment for $l_month</th>
<th>Principal Repaid</th>
<th>Balance Outstanding</th>
<th>Interest Payment for $l_month </th>
<th>INTEREST ACCUMULATED DURING FINNANCIAL YEAR</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['app_file_id'] . "</td>";
echo"<td>". $row['app_fname']."</td>";
echo"<td>". $row['app_lname']."</td>";
echo"<td>". $row['commit_date'] ."</td>";
echo"<td>". $row['computer_interest'] ."</td>";
echo"<td>". $row['loan_life'] ."</td>";
echo"<td>". $row['avg(app_ln_amnt)'] ."</td>";
echo"<td>". $row['Balance Outstanding'] ."</td>";
echo"<td>". $row['New Loan'] ."</td>";
echo"<td>". $row['SUM(r.receipt_on_principal)'] ."</td>";
echo"<td>". $row['Principal Repaid'] ."</td>";
echo"<td>". $row['avg(app_amnt_owed)'] ."</td>";
echo"<td>". $row['SUM(r.receipt_on_interest)'] ."</td>";
echo"<td>". $row['Interest Accumilated'] ."</td>";
echo "</tr>";
}
echo "</table>";
?>
【问题讨论】:
-
您用什么应用程序来打印这个?你的意思是你只想打印代码,还是处理后的html?
-
"只得到了我文档的html部分",什么意思?此外,表结构是无效的 HTML。
-
它是一段 php 代码我正在尝试从表格中打印结果,但我得到的只是页面模板,没有结果,模板是 html 部分示例,导航栏,页眉图片页脚等
-
使用 css 隐藏其他元素 - @media print { .noPrint { display:none; } }