我有一个下拉列表与选项未决和批准。它们都有单独的PHP文件用于排序,所以我想问一下,当我选择pending时,是否有一种方法可以使我在pendinglist.php中完成的查询显示在页面中?approvedlist.php也是如此。如果有办法,有人能告诉我怎么做和做什么吗?我应该使用js吗?请帮帮我..
approvedlist.php
<?php
include 'dbcontroller.php';
$sql = "SELECT * FROM requests where status='approved' ORDER by date DESC";
$result = $conn->query($sql);
?>
<table>
<thead>
<tr>
<th>Name</th>
<th>Batch Year</th>
<th>Section</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo '<tr>';
echo '<td>'.$row['firstname'].' '.$row['lastname'].' </td>';
echo '<td>'.$row['batchYr'].'</td>';
echo '<td>'.$row['section'].'</td>';
}
}
else {
echo "No records found.";
}
$conn->close();
?>
</tbody>
</table>我的pendinglist.php中有相同的代码,除了它们的查询:
$sql = "SELECT * FROM requests where status='pending' ORDER by date DESC";发布于 2016-04-26 18:29:28
你可以在你的页面中包含这两个php文件。通过使用类或ID对它们进行包装,确保它们位于唯一选择器中。
https://stackoverflow.com/questions/36862166
复制相似问题