if($row['name']==$_SESSION['name']){$checked="checked disabled";}else{$checked=" ";} $isin = in_array($row['name'],$array); if($isin){ echo "<label id='cyry'><input name='cyry[]' type='checkbox'".$checked." checked value='".$row['name']."'/>".$row['name']."</label> "; } if(!$isin){ echo "<label id='cyry'><input name='cyry[]' type='checkbox'".$checked." value='".$row['name']."'/>".$row['name']."</label> "; }
把存的(热门,标签,php)变成数组
查询数据字典,遍历,判断其是否在上面的数组里
如果在,显示的带checked
如果不在,显示的不带checked