I have an multiple category on my page to filter search.
http://localhost/shop/category/produkunggulan/CT0002
Example I have this category:
Brand
$qBrandList = mysqli_query($con, "SELECT P.productid, P.brandid_fk, B.Brandid, B.brand_name FROM tb_product P, tb_brand B WHERE P.brandid_fk = B.brandid AND P.categoryid_fk LIKE '%" . $getCategoryID . "%' GROUP BY B.brandid ORDER BY B.brand_name ASC");
while($dBrandList = mysqli_fetch_array($qBrandList))
{
?>
<div><label><input name="chkBrand[]" class="chkBrand" type="checkbox" value="<?php echo $dBrandList['brandid_fk']; ?>"/> <?php echo $dBrandList['brand_name']; ?></label></div>
<?php
}
Discount
<label><input type="checkbox" name="discount" value="Y"/> Diskon</label>
Now I want when user click the checkbox, it will be directly redirect to the url including the key of category (every click checkbox) and remove the value if uncheck.
Example I click EMORI then FOSSIL, so the URL should be:
http://localhost/shop/category/produkunggulan/CT0002?brand=BR0003,BR0010
I don't think you need to use a checkbox to redirect. Simply use input type 'submit'.
or add onchange event to submit
also use 'get' method in the tag to show your data at url.
One thing for sure your url wont look as you mentioned rather that it will look as
Here %5B is for'[' and %5D is for ']'.