Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "myHost"; //hidden
- $pw = "myPW"; //hidden
- $username = "myUser"; //hidden
- $dbname = "myDB"; //hidden
- //phpinfo();
- $con = mysqli_connect($host, $username, $pw, $dbname);
- //echo "<pre>";
- //print_r($con);
- //echo "</pre>";
- function fill_brand($con)
- {
- $output = '';
- $sql = "SELECT * FROM hersteller";
- $result = mysqli_query($con, $sql);
- while ($row = mysqli_fetch_array($result))
- {
- $output .= '<option value="'.$row["brand_id"].'">'.$row["brand_name"].'</option>';
- }
- return $output;
- }
- function fill_models($con)
- {
- $output = '';
- $sql = "SELECT * FROM modelle";
- $result = mysqli_query($con, $sql);
- while ($row = mysqli_fetch_array($result))
- {
- $output .= '<div class="col-md-3">';
- $output .= '<div style="border:1px solid #ccc; padding:20px; margin-bottom:20px;">'.$row["model_name"].'';
- $output .= '</div>';
- $output .= '</div>';
- }
- return $output;
- }
- ?>
- <div class="container">
- <h3>
- <select name="brand" id="brand">
- <option value ="">Show all Products</option>
- <?php echo fill_brand($con); ?>
- </select>
- <br /><br />
- <div class="row" id="show_model">
- <?php echo fill_models($con);?>
- </div>
- </h3>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment