FPDF:不为日历选定日期生成报告数据

FPDF: Report data not generates for calendar selected date

Jquery 日期选择器选择的日期未过滤 fpdf 报告的数据。 (我在下面添加了相关代码。)

日期选择器 js

$(document).ready(function() {
   $("#datepicker12").datepicker({ dateFormat: 'yy-mm-dd' });
   $("#datepicker12").datepicker("setDate", new Date);
});

表格HTML

<form id="salesReportForm" name="salesReportForm" method="post" action="../reports/dailyreports.php" >

日期选择器HTML

<input id="datepicker12"  name="datepicker12" tabindex="6" class="txtbx" /> 

按钮提交

<a target="popup" onclick="window.open('../reports/monthlyreports.php','popup','width=1200,height=900'); return false;">
                  <input type="button" name="btnMonthlyReports" id="btnMonthlyReports" value="GENERATE" />
                </a> 

report.php (FPDF)

if(isset($_POST['datepicker12'])){ $date = $_POST['datepicker12'];}

$result=mysqli_query($connection,"SELECT S.sales_id, I.item_name, ST.stock_code, S.qty, S.unit_price, S.discount, S.amount, S.date
                 FROM sales S 
                 INNER JOIN items I ON S.item_id=I.item_id 
                 INNER JOIN stock ST ON S.stock_id=ST.stock_id WHERE S.date BETWEEN $date.'00:00:00' AND $date.'23:59:59'"); 

$pdf->Cell(25,6,$date,'B',0,'L',0);

当我调试代码时,出现以下错误。

"Errormessage: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''00:00:00' AND .'23:59:59'' at line 4 "

感谢您帮助解决此问题。

我已经解决了这个问题,现在它完美运行了。我从包装提交按钮中删除了 <a>,它起作用了。

编辑后的代码如下:

<form id="dailysalesReportForm" name="dailysalesReportForm" method="post" action="../reports/dailyreports.php" ><tr>
                <td width="147" height="34"><div align="left">DAILY</div></td>
                  <td width="116"><label>
                    <div align="center">
                      <input id="datepicker12"  name="datepicker12" tabindex="6" class="txtbx" />
                    </div>
                    </label>
                    <div align="center"></div></td>
                  <td width="104"><div align="center"></div></td>
                  <td width="81"><label>
                    <div align="center"> 
                      <input type="submit" name="btnDailyReports" id="btnDailyReports" value="GENERATE"/>
                    </div>
                    </label></td>
              </tr></form>