php - How to filter mysql data on JSON with multiple checkbox -
I have a list of 10 + checkboxes below the 5 + category. I want to display the display based on the user's checkbox Depends with MYSQL with JSON. My HTML code is
& lt; H1 & gt; Filter & lt; / H1> & Lt; Form action = "filter.php" method = "post" & gt; & Lt; Div class = "panel-header filterhead" & gt; Filter by brand & lt; / Div & gt; & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "Samsung" & gt; Samsung & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "apple" & gt; Apple & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "nokia" & gt; Nokia & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "htc" & gt; HTC & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "oneplus" & gt; OnePlus & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "oneplus" & gt; OnePlus & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "oneplus" & gt; OnePlus & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "brand" value = "oneplus" & gt; OnePlus & lt; / Labels & gt; & Lt; Br> & Lt; / Div & gt; & Lt; Div class = "panel-header filterhead" & gt; Price filter & lt; / Div & gt; & Lt; Select class = "form-control" & gt; & Lt; Options & gt; Down to ₹ 5,000 & lt; / Options & gt; & Lt; Options & gt; Down to ₹ 10,000 & lt; / Options & gt; & Lt; Options & gt; Down to ₹ 15,000 & lt; / Options & gt; & Lt; Options & gt; Down to ₹ 20,000 & lt; / Options & gt; & Lt; Options & gt; Down to ₹ 25,000 & lt; / Options & gt; & Lt; Options & gt; Down to ₹ 35,000 & lt; / Options & gt; & Lt; Options & gt; Down from ₹ 40,000 & lt; / Options & gt; & Lt; Options & gt; ₹ 40,000 above & lt; / Options & gt; & Lt; / Select & gt;
& lt; Div class = "panel-header filterhead" & gt; Operating system & lt; / Div & gt; & Lt; Label & gt; & Lt; Input type = "checkbox" name = "OS" & gt; Android & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "OS" & gt; IOS & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "OS" & gt; Asha OS & Lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "OS" & gt; S40 / Symbian & lt; / Label & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "OS" & gt; Windows Phone & lt; / Label & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "OS" & gt; Blackberry OS & lt; / Label & gt; & Lt; Br> & Lt; / Div & gt; & Lt; Div class = "panel-header filterhead" & gt; Display & lt; / Div & gt; & Lt; Label & gt; & Lt; Input type = "checkbox" name = "display" & gt; Down to 4 inches & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "display" & gt; 4 inches by 5 inches & lt; / Label & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "display" & gt; 5 inches to 6 inches & lt; / Label & gt; & Lt; Br> & Lt; / Div & gt; RAM & lt; Label & gt; & Lt; Input type = "checkbox" name = "RAM []" value = "512" & gt; 512 MB & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "RAM []" value = "1" & gt; 1 GB & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "RAM []" value = "2" & gt; 2 GB & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "RAM []" value = "4" & gt; 4 GB & lt; / Labels & gt; & Lt; Br> & Lt; Label & gt; & Lt; Input type = "checkbox" name = "RAM []" value = "8" & gt; Up to 4 GB & lt; / Label & gt; & Lt; Br> & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Input type = "submit" value = "filter" /> & Lt; / Form & gt; I want to filter the data with JSON. Should I use the position for all combinations or any other solution?
Comments
Post a Comment