Filtering with searching box is not running together at once

Posted by  Kemal Doğru
 750  View(s)
Rate this:

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'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;




var p = multiple_values('p');

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

var url ="product.php?product=<?php echo

htmlentities($_GET['product']) ?>&s="+s+"&b="+b+"&p="+p;




function multiple_values(inputclass){

var val = new Array();

$("."+inputclass+":checked").each(function() {



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>


                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;">



        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; <?php echo ucfirst($row['brand']);



    <?php } ?>