我有下拉选择,当我点击提交按钮时,它显示基于下拉值的记录。它工作正常,但是当我刷新app_list2.php时,它什么也没有显示。我想保留显示在app_list2.php中的记录。我如何在会话中存储所有$ _POST值?
<?php
$mysqli = new mysqli("localhost", "root", "", "app");
if(isset($_POST['submit'])){
$drop = $_POST['drop_1'];
$tier_two = $_POST['tier_two'];
$where = "WHERE app_cn='$drop' AND app_plan_no='$tier_two'";
$result1 = $mysqli->query("
SELECT *, SUM(unit_cost*quantity) AS total_amount, SUM(unit_cost*1st_quarter) AS 1st_quarter_total, SUM(unit_cost*2nd_quarter) AS 2nd_quarter_total, SUM(unit_cost*3rd_quarter) AS 3rd_quarter_total,
SUM(unit_cost*4th_quarter) AS 4th_quarter_total, SUM((quantity)-(1st_q_qty_del+2nd_q_qty_del+3rd_q_qty_del+4th_q_qty_del)) AS balance
FROM app
$where
GROUP BY counter ORDER BY counter
");
?>
<?php
echo'<table id="tfhover" cellspacing="0" class="tablesorter" style="text-transform:uppercase;">
<thead>
<tr>
<th>Item</th>
<th>Description</th>
<th>Fund Source</th>
<th>Unit</th>
<th>Unit Cost</th>
</tr>
</thead>';
echo'<tbody>';
$i=1;
while($row = $result1->fetch_assoc()){
if($row['app_cn'] != '')
{
echo'<tr>
<td>'.$row['item_name'].'</td>
<td>'.$row['item_description'].'</td>
<td>'.$row['fund_source'].'</td>
<td>'.$row['unit'].'</td>
<td>'.number_format($row['unit_cost'], 2, '.', ',').'</td>
</tr>';
}
}
echo "</tbody></table>";
}
?>
检查错误,似乎是一个PHP错误。并清理您的查询字段 – Sal00m
没有错误,我认为它bcoz它没有身份证确定记录? –
它因为刷新,你将失去发布值的跟踪,所以什么都不会出现 –