1180 posts
  • Has referred 200+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+2 more

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>

<?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.. :)


Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes