developed an admin panel in which users can add products from there and I put fields over there as size and color for the dresses dresses sizes and color would be more then 1 so I made 2 more tables in the database named prod_size and prod_color here is the table structure
table name : prod_size
| prod_id | size |
------------------
| 6 | S |
| 6 | M |
| 6 | L |
| 7 | S |
| 7 | M |
table name : prod_color
| prod_id | color |
------------------
| 6 | white |
| 6 | blue |
| 6 | black |
| 7 | orange|
| 7 | black |
and third one is products table where the products are stored tabl name : products
CREATE TABLE IF NOT EXISTS `products` (
`prod_id` int(11) NOT NULL AUTO_INCREMENT,
`product_name` varchar(255) NOT NULL,
`product_price` int(11) NOT NULL,
`product_image` varchar(255) NOT NULL,
`product_category` varchar(255) NOT NULL,
`description` text NOT NULL,
`status` varchar(255) NOT NULL,
`template` varchar(255) NOT NULL,
PRIMARY KEY (`prod_id`)
)
Now on the front end here comes the problem for me when I start developing filter search result when I search it with range works fine but now how do I make it filter by color and size here is the code which I had used fr filtering by price??? Here in this field the input fields i.e check boxes will be dynamic right now I am assuming
<form method="POST" action="product.php">
<div class="price-box">
<h5>Price</h5>
<input type="hidden" name='price_range' class="range-slider" min="0" max="600" value="23" />
</div>
<div class="size-box">
<h5>size</h5>
<ul>
<li> <input type="checkbox" name="option[]" value=""> <span class="check-txt">S (10)</span></li>
<li> <input type="checkbox" name="option[]" value=""> <span class="check-txt">M (10)</span></li>
<li> <input type="checkbox" name="option[]" value=""> <span class="check-txt">L (10)</span></li>
</ul>
</div>
<div class="color-box">
<h5>color</h5>
<ul>
<li> <input type="checkbox" name="color[]" value=""> <span class="check-txt">White (2)</span></li>
<li> <input type="checkbox" name="color[]" value=""> <span class="check-txt">Black (3)</span></li>
<li> <input type="checkbox" name="color[]" value=""> <span class="check-txt">Orange (3)</span></li>
<li> <input type="checkbox" name="color[]" value=""> <span class="check-txt">Blue (4)</span></li>
</ul>
</div>
<input type="submit" name="filter" value="Filter Results" />
</form>
For refine search result I used the following code
$num_rec_per_page=9;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
if(isset($_POST['filter'])) {
$range = $_POST['price_range'];
$rg = explode(',', $range);
$range1 = $rg[0];
$range2 = $rg[1];
$get_prod = mysqli_query($connection, "SELECT * FROM products WHERE product_price BETWEEN '$range1' AND '$range2' LIMIT $start_from, $num_rec_per_page");
} else {
$get_prod = query('products', "LIMIT $start_from, $num_rec_per_page");
}
$total = mysqli_num_rows($get_prod);
while($prod = mysqli_fetch_assoc($get_prod)) {