Php 如何使用多个复选框过滤JSON上的mysql数据

Php 如何使用多个复选框过滤JSON上的mysql数据,php,mysql,json,Php,Mysql,Json,我有5个类别下的10+复选框列表。我想显示的结果取决于用户选择的带有来自MYSQL的JSON的复选框。我的html代码是 <h1>Filter</h1> <form action="filter.php" method="post"> <div class="panel-heading filterhead">Filter by brand</div> <label><input type="

我有5个类别下的10+复选框列表。我想显示的结果取决于用户选择的带有来自MYSQL的JSON的复选框。我的html代码是

<h1>Filter</h1> 
<form action="filter.php" method="post"> 
   <div class="panel-heading filterhead">Filter by brand</div>
        <label><input type="checkbox" name="brand" value=" Samsung "> Samsung</label><br>
        <label><input type="checkbox" name="brand" value=" Apple "> Apple</label><br>
        <label><input type="checkbox" name="brand" value="Nokia "> Nokia</label><br>
        <label><input type="checkbox" name="brand" value=" HTC "> HTC</label><br>
        <label><input type="checkbox" name="brand" value=" OnePlus "> OnePlus</label><br>
        <label><input type="checkbox" name="brand" value="  OnePlus"> OnePlus</label><br>
        <label><input type="checkbox" name="brand" value=" OnePlus "> OnePlus</label><br>
        <label><input type="checkbox" name="brand" value=" OnePlus "> OnePlus</label><br>
      </div>


      <div class="panel-heading filterhead">Price Filter</div>
        <select class="form-control">
            <option>Below ₹5,000</option>
            <option>Below ₹10,000</option>
            <option>Below ₹15,000</option>
            <option>Below ₹20,000</option>
            <option>Below ₹25,000</option>
            <option>Below ₹35,000</option>
            <option>Below ₹40,000</option>
            <option>Above ₹40,000</option>
        </select>
过滤器
按品牌过滤
三星
苹果
诺基亚
HTC
OnePlus
OnePlus
OnePlus
OnePlus
价格过滤器 在下面₹5,000 在下面₹10,000 在下面₹15,000 在下面₹20,000 在下面₹25,000 在下面₹35,000 在下面₹40,000 在上面₹40,000

操作系统
安卓
iOS
Asha OS
S40/Symbian
Windows Phone
黑莓操作系统
展示 低于4英寸
4英寸到5英寸
5英寸到6英寸
内存
512 MB
1GB
2 GB
4 GB
超过4 GB

我想用JSON过滤数据。我应该使用所有组合的if条件还是有其他解决方案

你可以使用一个有名称的表并循环使用它。你能给我一个示例代码吗?对不起,没有。你有你的字段,它们有名称。把它们放在一个数组中,并在上面运行。
      <div class="panel-heading filterhead">Operating System</div>
        <label><input type="checkbox" name="os"> Android</label><br>
        <label><input type="checkbox" name="os"> iOS</label><br>
        <label><input type="checkbox" name="os"> Asha OS</label><br>
        <label><input type="checkbox" name="os"> S40 / Symbian</label><br>
        <label><input type="checkbox" name="os"> Windows Phone</label><br>
        <label><input type="checkbox" name="os"> Blackberry OS</label><br>
      </div>

      <div class="panel-heading filterhead">Display</div>
        <label><input type="checkbox" name="display" > Below 4 inches</label><br>
        <label><input type="checkbox" name="display"> 4 inches to 5 inches</label><br>
        <label><input type="checkbox" name="display"> 5 inches to 6 inches</label><br>
    </div>
        <label><input type="checkbox" name="ram[]" value="512 "> 512 MB</label><br>
        <label><input type="checkbox" name="ram[]" value="1 "> 1 GB</label><br>
        <label><input type="checkbox" name="ram[]" value="2 ">  2 GB</label><br>
        <label><input type="checkbox" name="ram[]" value="4 "> 4 GB</label><br>
        <label><input type="checkbox" name="ram[]" value="8 "> Above 4 GB</label><br>
      </div>

</div>
    <input type="submit" value="Filter" /> 
</form>