所以我要做的是,我有一个按钮,可以生成一个pdf文件,其中包含数据库中单个表的所有数据,现在我正试图生成一个只有选定值的pdf文件。最近,我添加了一个“input type=datetime local”,我要做的基本上是我有两个datetime local,它们有一个开始日期和结束日期,它只在给定日期之间生成一个pdf
接下来是棘手的部分,我的数据库中的“datetime”列的格式是(年/月/日:小时:分:秒),本地日期时间的格式是(天/月/年:小时:分:分:AM/PM)。我听说不建议在你的数据库中使用时间戳,但我现在的情况是我不能再更改数据库了。
下面是打印所有数据的生成pdf代码
}
if(isset($_POST["generate_pdf"]))
{
require_once('tcpdf/tcpdf.php');
$obj_pdf = new TCPDF('L', 'mm', 'LETTER', true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetAuthor('Nicola Asuni');
$obj_pdf->SetSubject('TCPDF Tutorial');
$obj_pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$obj_pdf->SetTitle("Incident Report");
$obj_pdf->SetHeaderData('', '', PDF_HEADER_TITLE, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(2, '7', PDF_MARGIN_RIGHT, '10');
$obj_pdf->setPrintHeader(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->SetFont('helvetica', '', 5);
$obj_pdf->AddPage();
date_default_timezone_set("Asia/Manila");
$content = '';
$content2 = date("F d, Y h:i:s A",mktime());
$content .= '
Incident Report
School | Grade/Level | Section | Date and Time | Incident Type | Incident Description | Sender | Person Involved | Students that tagged safe | Students that tagged unsafe | Male Count | Female Count | Number of involved people | Attachment |
---|
$content .= fetch_data();
$content .= '
';$obj_pdf->writeHTML($content);
$obj_pdf->writeHTML($content2);
$obj_pdf->Output('report.pdf', 'I');
}
?>
下面是日期时间本地代码
Date From:
min="1000-01-01" class="form-group">
Date To:
max="3000-12-31" class="form-group">
有人能告诉我该怎么做,该怎么做吗?我应该用另一个日期时间选择器吗?或者我应该坚持我所拥有的。如有任何答复,将不胜感激。谢谢您!