Q:

HTML/PHP/SQL - On selected dropdown option show information related to the sql entry

So basically, if you didn't understand the question, I have a dropdown menu with car brands (TABLE BRANDS), and when you select a certain option like "Volkswagen" it should display information about car models that are related to the brand "Volkswagen". The car models are in a table called CARS and for example when you select "Volkswagen", below it should display "Polo", "Golf" etc (every entry that is connected with the foreign key brand_id which is located in CARS).
How can I make this happen ? Here's where I've got so far:
<?php
                    $sql = "SELECT brands.name, cars.id, cars.model, cars.mileage, cars.color FROM brands, cars WHERE brands.id = cars.brand_id ORDER BY cars.model DESC, brands.name;";
                    $result = $mysqli->query($sql);

                    $sql1 = "SELECT id, name FROM brands";
                    $result1 = $mysqli->query($sql1);

                ?>

<select>
           <?php 
            while ($row = mysqli_fetch_array($result1))
            {
              echo '<option value="'. $row['id'] .'">'. $row['name'] .'</option>';
            }
            ?>
            </select>

A:

The code is almost right. You should use the dropdown in a form and submit it to another file or php page. On another page, you can use the php code and process the result over there. Get the input from dropdown and submit it to php page.

