如果$row['featured'];
= 1,如果$row['featured']; = 0
未显示为已选中,我需要将广播显示为已检查
这是代码
<?php
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td width="6%" align="center"><input type="radio" name="features" value="<?php echo $row['featured']; ?>" /></td>
<td width="35%"><?php echo $row['job_title']; ?></td>
<td width="24%"><?php echo $row['category_name'] ?></td>
<td width="15%"><?php echo $row['job_location']; ?></td>
<td width="10%"><?php echo $row['status'] ?></td>
<td width="10%"><a href="job_edit.php?id=<?php echo $row['job_id']; ?>">Edit</a></td>
</tr>
<?php
}
?>
答案 0 :(得分:2)
<input type="radio" name="features" value="<?php echo $row['featured']; ?>"
<?php echo ($row['featured'] == 1?'checked':'')?>/>
答案 1 :(得分:1)
<input type="radio" name="features" value="<?php echo $row['featured']; ?>"
<?php echo $row['featured']?'checked="checked"':'';?>/>