选择始终选择最后一个值

时间:2018-06-29 16:20:39

标签: php mysql

我正在尝试按品牌搜索产品,因此我创建了此选择,但是它仅选择列表中的最后一个选项。

<select name="brand_id" >
    <option>Brand</option>
    <?php 
        $get_brands = "select * from brands";
        $run_brands = mysqli_query($con, $get_brands);

        while ($row_brands=mysqli_fetch_array($run_brands)) {
            $brand_id = $row_brands['brand_id']; 
            $brand_title = $row_brands['brand_title'];

           echo "<option value='$brand_id'>$brand_title</option>";

        }


    ?>

</select>
<?php
    echo "$brand_title<a href='results2.php?brand_id=$brand_id'>Search</a>";
?>  

0 个答案:

没有答案