2017-09-04 67 views
0

所以我试图根据组合框中选定的项目对信息进行排序。我熟悉部分PHP,但仍在学习。PHP:尝试使用组合框筛选表中的数据库信息

我能够用我的数据库中的'Brand_Name'列信息填充组合框。

这是我的电流输出: image

它不是,虽然过滤,它刚上市在数据库中的所有项目

下面

见代码:

<?php 
$hostname = "localhost"; 
$username = "root"; 
$password = "root"; 
$databaseName = "Clients"; 
$connect = mysqli_connect($hostname, $username, $password, $databaseName); 
$queryDropdown = "SELECT * FROM `Brands` WHERE 1"; 
$result = mysqli_query($connect, $queryDropdown); 
$queryGrid = "SELECT * FROM `Brands` "; 
$SearchResult = mysqli_query($connect, $queryGrid); 
?> 
<html> 
<head> 
    <title>PokerPass</title> 
     <link rel="stylesheet" type="text/css" href="styles/Main.css"> 
     <link rel="stylesheet" type="text/css" href="styles/ComboBox.css"> 
     <link rel="stylesheet" type="text/css" href="styles/TableGrid.css"> 
</head> 
<body > 
    <div id="Container" class="Container"> 
     <div id="Header" class="Header"> 

     </div> 
     <div id="Body" class="Body"> 
      <div name="start" id="Filter_Bar" class="Filter_Bar"> 
       <select class="soflow" id="soflow" Size="1"> 
        <?php while($row1 = mysqli_fetch_array($result)):; ?> 
        <option><?php echo $row1[1]; ?></option> 
       <?php endwhile; ?> 
       </select> 
       <button class="Submit" ><span><strong>Search<strong></span></button> 
       <!--<input class="Submit" type="submit" name="search" value="Search </span>">--> 
      </div> 
      <div id="Data_Grid" class="Data_Grid"> 
        <table> 
        <tr> 
         <th>Server ID</th> 
         <th>Client</th> 
         <th>Operator</th> 
         <th>Username</th> 
         <th>Password</th> 
        </tr> 
        <?php while ($row = mysqli_fetch_array($SearchResult)):; ?> 
        <tr> 
         <td><?php echo $row['ServerID']; ?></td> 
         <td><?php echo $row['Brand_Name']; ?></td> 
         <td><?php echo $row['Operator_Name']; ?></td> 
         <td><?php echo $row['Username']; ?></td> 
         <td><?php echo $row['Password']; ?></td> 
        </tr> 
        <?php endwhile; ?> 
        </table> 
      </div> 
     </div> 
     <div id="Footer" class="Footer"> 

     </div> 
    </div> 
</body> 
</html> 
+0

那么你是如何使过滤器工作?您使用JavaScript标记了该问题,但实际上并未显示任何JavaScript代码。 –

+0

您可以使用onChange()函数从