使用Wordpress我創建了一個多選框,以便用戶可以選擇要排除的類別。最初加載頁面時,我會看到預先選擇的默認值。但是,當我選擇新的值並保存...我只看到單詞「數組」回顯,沒有選擇?多選與爆炸:只返回單詞「數組」
<select class="amultiple" id="<?php echo $value['id']; ?>" name="<?php echo $value['id']; ?>[]" multiple="multiple" size="8">
<?php
global $options;
foreach ($options as $value) {
if (get_settings($value['id']) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings($value['id']);
}
}
$categories = &get_categories('type=post&orderby=name&hide_empty=1');
if ($categories) {
$ex_cat = implode(',', $tt_cat_exclude);
foreach ($categories as $category) {
$selected = (in_array($ex_cat, $category->cat_ID)) ? ' selected="selected"' : '';
echo '<option value="' . $category->cat_ID . '"' . $selected . '>' . $category->cat_name . '</option>' . "\n";
}
}
?>
</select>
<br />For testing purposes, print variables: <?php echo $ex_cat; ?>
http://i48.tinypic.com/k9e3qq.gif
好吧,單詞「陣列」不打印...現在隨機數字是:) – Greg 2009-12-07 08:53:52
這是現在工作...但頁面刷新後 - 不見 – Greg 2009-12-07 08:57:05
很高興聽到它! – 2009-12-07 09:04:42