<?php
$data = array();
$Type = $_POST['Type'];

$mysqli = new mysqli("localhost","root","","inspection");

// Check connection
if ($mysqli -> connect_errno) {
  echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
  exit();
}else{

    $desc = "Select * FROM inspection_description WHERE type='$Type'";
    $descRes = $mysqli->query($desc);
    while($rowDesc = mysqli_fetch_array($descRes)){

      $data[] = array('id'=>$rowDesc['id'],
      'Desc'=>$rowDesc['Flaw Description']) ;

    }



    echo json_encode($data);


}


?>
