<?php
session_start();
ob_start();
 include "dbPDO.php";
 if(isset($_POST["brand_name"])){
    $brand_name = $_POST["brand_name"];
    $output = array();
    $sql =$db->prepare("SELECT kinds , kinds from brand where brand_name = ? order by kinds ");
  $sql->bindParam(1,$brand_name);
  $sql->execute();
  $i=0;
   if($sql->rowCount()>0)
     while($row = $sql->fetch())
               {
                   $output[$i] = array(
                                 "value" => $row["kinds"],
                                 "data"  => $row["kinds"]
                                 );
                      $i++ ;
                 }
              }
          else
          { $output[0]= 'ماركة جديدة'; }
echo json_encode($output);

   ?>
