我使用下面的代碼來檢查每個循環的checbox。但複選框不檢查基於數組的值。我用爆炸來創建$ newsource.Actualy我有 sourceIds = 100252 & sourceIds = 100111複選框內部自舉選擇框內使用php
$newsource = Array ([0] => sourceIds=100252 [1] => sourceIds=100111);
<select id="source" class="form-control source" multiple="multiple">
<?php $loop=0; foreach($sources->sources as $row) {
echo $loop;
if($newsource[$loop]==$row->id) {
echo '<option checked="'.checked.'" value="'.$row->id.'">'.$row->name.'</option>';
}
else {
echo '<option value="'.$row->id.'">'.$row->name.'</option>';
echo "a".$newSource[$loop];
}
$loop = $loop +1;} ?></select>
你有沒有注意到$ newSource的=陣列([0] => sourceIds = 100252 [1] => sourceIds = 100111);。我認爲這是跌破發行 – aniltc 2014-11-23 13:30:26
辦理登機,我該怎麼解決了 – aniltc 2014-11-23 14:33:47