2017-09-04 12 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()函數從