---
title: "Filtering with searching box is not running together at once"  
description: "Filtering with searching box is not running together at once"  
author: "Kemal Dogru"  
published: 2018-03-15  
updated: 2018-03-15  
canonical: https://www.mindstick.com/forum/34434/filtering-with-searching-box-is-not-running-together-at-once  
category: "java"  
tags: ["javascript", "php"]  
reading_time: 2 minutes  

---

# Filtering with searching box is not running together at once

I have [product](https://www.mindstick.com/articles/75385/full-product-keys) filter and [search](https://www.mindstick.com/articles/65368/best-smo-services-company-in-hyderabad-improve-search-rankings) box. But, I select items through [filtering](https://www.mindstick.com/forum/33958/how-to-filtering-with-the-entity-framework-is-an-asp-dot-net-mvc-application) 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](https://www.mindstick.com/forum/34628/server-get-post-method-in-php) for searching box.

I think,the main [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is in my script "var s" php [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) where I'm getting cities from .

Here's my script;

<script>

$([function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)(){

$('.item_filter').change(function(){

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;

window.location=url;

});

});

function multiple_values(inputclass){

var val = new Array();

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

val.push($(this).val());

});

return val.join('-');

}

</script>

Search Box

<form class="search" name="search" method="POST"

action="product.php?product=<?php echo ''.htmlentities($_GET['product']).''; ?>" >

<a href="[javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-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](https://www.mindstick.com/forum/1797/change-text-on-button-in-datalist-not-working) 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](https://www.mindstick.com/articles/291/how-should-use-checkbox-control-in-vb-dot-net)" 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']);

?></a>

</label>

<?php } ?>

</div>


---

Original Source: https://www.mindstick.com/forum/34434/filtering-with-searching-box-is-not-running-together-at-once

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
