<?php
session_start();
include 'db_connection.php';

if(isset($_POST['category'])){
    $category = $_POST['category'];
    $qry_new = mysqli_query($conn, "SELECT * FROM mobilecategory WHERE catename LIKE '%$category%'");  
    
    if ($qry_new->num_rows > 0) {
        while($row = $qry_new->fetch_assoc()) {
            echo "<li onClick='filtercat(".$row['ctid'].")'>".$row['catename']."</li>";
        }
    }



}
if(isset($_POST['brand'])){
    $brand = $_POST['brand'];
    $qry_new = mysqli_query($conn, "SELECT * FROM mobile_brand WHERE brand_name LIKE '%$brand%'");  
    
    if ($qry_new->num_rows > 0) {
        while($row = $qry_new->fetch_assoc()) {
            echo "<li onClick='filterbrand(".$row['brand_id'].")'>".$row['brand_name']."</li>";
        }
    }



}

if(isset($_POST['subcat'])){
    $subcat = $_POST['subcat'];
    $qry_new = mysqli_query($conn, "SELECT * FROM mobilesubcategory WHERE subname LIKE '%$subcat%'");  
    
    if ($qry_new->num_rows > 0) {
        while($row = $qry_new->fetch_assoc()) {
            echo "<li onClick='filtersubcat(".$row['sbid'].")'>".$row['subname']."</li>";
        }
    }



}






?>