Filtering with searching box is not running together at once

I have product filter and search box. But, I select items through filtering bar by itself and fetching data perfectly but I can’t make it run by searching city and filtering items at once. What I want is to searching through search box and than select price and brand according to city I selected and fetch all the data. I have searching box and filtering bar. I’m also using POST method for searching box.

I think,the main problem is in my script “var s” php parameter where I’m getting cities from .

Here’s my script;

$(function(){
$('.item_filter').change(function(){   
var p   = multiple_values('p');

var s   ='<?php echo $_POST["search"]; ?>';

var url ="hizmet_ariyorum.php?hizmet=<?php echo 
htmlentities($_GET['product']) ?>&s="+s+"&b="+b+"&p="+p;
window.location=url;
});

});


function multiple_values(inputclass){
var val = new Array();
$("."+inputclass+":checked").each(function() {
val.push($(this).val());
});
return val.join('-');
}

Search Box

    <form class="search" name="search" method="POST" 
  action="product.php?product=<?php echo ''.htmlentities($_GET['product']).''; ?>" >

        <a href="javascript:void(0);"><input  id="small_search"  name="searchTerm" class="item_filter s" <?php { echo "checked"; } ?> list="local"  /></a>

            <?php
                while($row = mysqli_fetch_assoc($result)){
                    $local = ($row['local']); ?>
            <a href="javascript:void(0);" target="_blank"><input type="submit"  id="small_search_btn"  value="Search"></a >
                <datalist id="local">
                <option value="<?php echo ''.htmlentities($row['local']).'';  ?>"></option>

            <?php } ?>
        </form >

**Filtering **

  <div class="list-group" style="font-size:14px;">
     <h4 style="font-size:16px; font-weight: bold; color:black;"> 
      </h4>

     <?php 

        some sql statement..
         ?>

     <a href="javascript:void(0);" class="list-group-item" 
     id="left_filtering" >  
     <label >
     <input type="checkbox" class="item_filter b" value="<?php echo 
     htmlentities($row['brand']); ?>" <?php if(in_array($row['brand'],$b 
     {echo "checked"; } ?> >&nbsp;&nbsp; <?php echo ucfirst($row['brand']); 
     ?></a>

    </label>
    <?php } ?>  

 </div>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.