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

时间:2015-01-22 12:31:20

标签: 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="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>

      <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>

我想用JSON过滤数据。我是否应该使用所有组合的条件或有任何其他解决方案?

0 个答案:

没有答案