1175 posts
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
mabuc says

Hello guys,

I’m using this tutorial- http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wordpress-options-panel, does any of you tried to add multiple checkbox? and save its value..

here’s what I did:
$categories = get_categories('hide_empty=0&orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
    $wp_cats[$category_list->cat_ID] = $category_list->cat_name;
}

array( "name" => "Exclude Category",
            "desc" => "",
            "id" => $shortname."_exclude_blog_category",
            "type" => "checkbox_multiple",    
            "options" => $wp_cats,    
            "std" => ""),    

case "checkbox_multiple":
?>

<div class="rm_input rm_select">
<label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label>

<?php foreach ($value['options'] as $option) { ?>
<input type="checkbox" id="<?php echo $value['id']; ?>" name="<?php echo $value['id']; ?>" value="<?php echo $value['id']; ?>" <?php if (get_settings( $value['id'] ) == $option) { echo 'checked="checked"'; } ?>>
<?php echo $option; ?><br /><?php } ?>

<small><?php echo $value['desc']; ?></small><div class="clearfix"></div>
</div>

<?php break; ?>

It displays the list of categories available, my problem is it only get 1 value from the choices even if I select multiple categories. I appreciate any help.. :)

mark

by
by
by
by
by
by