View difference between Paste ID: XVYtBzBv and AUF2XetV
SHOW: | | - or go back to the newest paste.
1
<?php
2
$host = "myHost"; //hidden
3
$pw = "myPW"; //hidden
4
$username = "myUser"; //hidden
5
$dbname = "myDB"; //hidden
6
7
$con = mysqli_connect($host, $username, $pw, $dbname);
8-
//phpinfo();
8+
9
echo "<pre>";
10
print_r($_POST);
11-
//echo "<pre>";
11+
echo "</pre>";
12-
//print_r($con);
12+
13-
//echo "</pre>";
13+
$output = '';
14
if(isset($_POST["brand_id"]))
15-
function fill_brand($con)
15+
16
     if($_POST["brand_id"] != '')
17-
  $output = '';
17+
     {
18-
  $sql = "SELECT * FROM hersteller";
18+
          $sql = "SELECT * FROM modelle WHERE brand_id = '".$_POST["brand_id"]."'";
19-
  $result = mysqli_query($con, $sql);
19+
     }
20
     else
21-
  while ($row = mysqli_fetch_array($result))
21+
     {
22-
  {
22+
          $sql = "SELECT * FROM modelle";
23-
    $output .= '<option value="'.$row["brand_id"].'">'.$row["brand_name"].'</option>';
23+
     }
24-
  }
24+
     $result = mysqli_query($connect, $sql);
25
26-
  return $output;
26+
     while($row = mysqli_fetch_array($result))
27
     {
28
          $output .= '<div class="col-md-3"><div style="border:1px solid #ccc; padding:20px; margin-bottom:20px;">'.$row["model_name"].'</div></div>';
29
     }
30-
function fill_models($con)
30+
     echo $output;
31
}
32-
  $output = '';
32+
?>