Code works!

I've two custom publish types: Events and Artists. I am using WPAlchemy MetaBox PHP class , trying to produce a metabox with a number of dynamically produced checkboxes (i.e. you will see a checkbox for every Artists publish) within the Events publish editor that will permit me to choose which Artists are showing up in an Event.

Any help or insight much appreciated! Thanks!

This code works fine to show the checkboxes (from checkbox_meta.php):

<div class="my_meta_control">

    <label>Group checkbox test #2</label><br/>

        global $post;
        $artists = get_posts('post_type=artists');
        foreach($artists as $artist) :
        $slug = $artist->post_name;

        <?php $mb->the_field('cb_ex2', WPALCHEMY_FIELD_HINT_CHECKBOX_MULTI); ?>

        <input type="checkbox" name="<?php $mb->the_name(); ?>" value="<?php echo $slug; ?>"<?php $mb->the_checkbox_state($slug); ?>/><?php echo $artist->post_title; ?><br/>

    <?php endforeach; ?>

    <input type="submit" class="button-primary" name="save" value="Save">


This code from functions.php:

include_once 'assets/functions/MetaBox.php';
if (is_admin()) wp_enqueue_style('custom_meta_css', 'wp-content/themes/bam/assets/css/meta.css');

define('THEMEASSETS', STYLESHEETPATH . '/assets');

$custom_metabox = new WPAlchemy_MetaBox(array
    'id' => '_custom_meta',
    'title' => 'My Custom Meta',
    'types' => array('sp_events'),
    'template' => THEMEASSETS . '/functions/checkbox_meta.php'

I believe this lines are the issue

$data = stripslashes_deep($_POST['artist']);

Attempt to change it out to

$data = stripslashes_deep($_POST);

I have created a assistant class that might assist you with creating wordpress meta boxes.