sql3 = "SELECT activityid FROM ActivityShare where companyid = '$branchid'";
$result3 = mysql_query($sql3);
while($row3=mysql_fetch_assoc($result3)){
//$post_tags = "1@2@";
$post_tags= $row3['activityid'];
$arr_tags = array_flip(explode("@", $post_tags));
}
$tags = mysql_query("SELECT * FROM Activity WHERE companyid = '$companyid'");
while ($row = mysql_fetch_assoc($tags)){
$check = isset($arr_tags[$row['activityid']])? 'checked="checked"' : "";
echo '<input type="checkbox" name="tags[]" value="'.$row['activityid'].'" '.$check.' />' .$row['activityname'].'<br />';
echo "\n";
}
目前列出数据库中的所有复选框,但另一个表有一个结果,我希望预先选择这些框。 提前致谢