我有5个复选框,
<label class="checkbox-inline"><input type="checkbox" name="manhattan" value="Manhattan" >Manhattan</label>
<label class="checkbox-inline"><input type="checkbox" name="bronx" value="Bronx" >Bronx</label>
<label class="checkbox-inline"><input type="checkbox" name="brooklyn" value="Brooklyn" >Brooklyn</label>
<label class="checkbox-inline"><input type="checkbox" name="queen" value="Queen" >Queen</label>
我想搜索
---------------------------------
id | location
---------------------------------
1 | Manhattan,Brooklyn,Queen
2 | Queen,Brooklyn
---------------------------------
这是我的查询
extract($_POST);
$locprefervals = $manhattan.",".$bronx.",".$brooklyn.",".$queen.",".$staten;
$locprefer = rtrim($locprefervals,',');
$query = "select * from tbl where location='".$locprefer ."'";
当用户在复选框中选中某个位置时,我需要比较每个逗号分隔值的表格“location”中的数据。