我做一个PHP页面我要附加与列表框选项值复选框我如何连接复选框,这里是我的代码:如何添加复选框在PHP中的选择选项?
<select name="recepients[]" multiple size="10" multiple="multiple" >
<?
//echo $eventid=$_POST['events'];
$count=count($_POST['events']);
for($i=0; $i<$count; $i++){
$select="select b.first_name,b.last_name from buyers b,registrations r where b.buyer_id=r.buyer_id and r.event_id='".$_POST['events'][$i]."' group by r.buyer_id";
$res = $GLOBALS ['mysqli']->query ($select) or die ($GLOBALS ['mysqli']->error . __LINE__);
if ($res->num_rows > 0)
{
while($row = $res->fetch_assoc())
{
?>
<input type="checkbox" name="receptionts[]" checked="checked"/>
<option value="<?=$row['first_name']?>"><?=$row['last_name']?></option>
<?
}
}
}
?>
</select>
你所说的“重视”是什么意思? –
我的意思是选项值有复选框,其始终选择 –
所以你想有一个默认选项? – elitechief21