
PK 
<?php
session_start();
require_once 'common/common.php';
require_once 'common/secure.php';
include "connexion.php";
echo $_GET[part];
/////// for second drop down list we will check if category is selected else we will display all the subcategory/////
$cat=$_GET[cat];
if(isset($cat) and strlen($cat) > 0){
$quer=mysql_query("SELECT DISTINCT * FROM head WHERE parhead='$cat' and status='active' order by headname") or die(mysql_error());
}else{
$quer=mysql_query("SELECT DISTINCT * FROM head WHERE status='active' order by headname") or die(mysql_error());
}
////////// end of query for second subcategory drop down list box ///////////////////////////
while ($row = mysql_fetch_assoc($quer)) {
//print_r($row);
$colors[]=$row['headname'];
}
//mysql_free_result($result);
//mysql_close($link);
// check the parameter
// initialize the results array
$results = array();
// search colors
foreach($colors as $color)
{
// if it starts with 'part' add to results
if( strpos($color, $_GET['part']) === 0 ){
$results[] = $color;
}
}
// return the array as json with PHP 5.2
echo json_encode($results);


PK 99