0
我有一個複選框列表顯示在下面。這顯示所有接觸器,並允許通過複選框選擇它們。顯示基於數組的複選框列表
<?php
$query = "SELECT * FROM form_4 GROUP BY contractors ASC";
$result = mysql_query($query);
?>
<li><select multiple="multiple" size="10" name="contractors[]">
<option value="None Yet" selected="selected">None Yet
</option>
<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<option value="<?php echo $line['contractors'];?>"> <?php echo $line['contractors'];?> </option>
<?php
}
?>
</select></li>
我保存,我想生成以上,但與數組中的項目已經在下面選中/選擇列表中的其他地方的數組。
<?php
$options = unserialize('contractors');
$result = mysql_query("SELECT * FROM form_2 WHERE jobname = 'testjob' GROUP BY jobname ORDER BY biddate ASC LIMIT 0, 1");
while($row = mysql_fetch_array($result))
{
$contractors = unserialize($row['contractors']);
foreach ($contractors as $contractor)
echo "" . htmlspecialchars ($contractor).' - ';
?>
任何幫助將不勝感激。
我改變檢查,選擇和它的工作,非常感謝你。我明白我在試圖出錯。 – PaperBagged 2013-02-25 06:03:13
@PaperBagged:OK酷:D – 2013-02-25 06:04:39