我有一些像这样的复选框
<form action="tt.php" method="post">
<input type="checkbox" name="lvl[]" value="0">0 
<input type="checkbox" name="lvl[]" value="1">1 
<input type="checkbox" name="lvl[]" value="2">2 
<input type="checkbox" name="lvl[]" value="3">3 
<input type="checkbox" name="lvl[]" value="4">4 
<input type="submit" value="Ok">
如何像这样将选中的值添加到 SQL 查询中?:
如果选中 2 和 4 然后select name,lvl,team from $table where lvl=2 or lvl=4
如果选中 2 和 4 AND 0然后select name,lvl,team from $table where lvl=2 or lvl=4 or team='abc'
(如果选中 0 则 'select' 必须包含其中 team='abc' 的字符串,如果没有 - 不要)
如果没有选择则select name,lvl,team from $table