title: Saving checkboxes in wordpress custom post type
body: <p>Hi I have checkboxes defined as such:</p>
  
  <pre><code>"languages" =&gt; array("name" =&gt; "languages",
  "title" =&gt; "Languages","description" =&gt; "",
  "style" =&gt; "checkboxes","options" =&gt; array("1" =&gt; "option1","2" =&gt; "option2")),
  </code></pre>
  
  <p>they display fine using:</p>
  
  <pre><code>foreach($meta_box['options'] as $radio_value) { 
  echo '&lt;input type="checkbox" name="'.$meta_box['name'].'_value'.'"
  value="'.$radio_value.'"'; if ($meta_box_value == $radio_value) { echo ' 
  checked="yes"'; } echo '/&gt; '.$radio_value. '&lt;br/&gt;';
  </code></pre>
  
  <p>Now I need to save them.</p>
  
  <p>I am using this code to save all the other fields, but naturally it will only save the last checked checkbox:</p>
  
  <pre><code>if(get_post_meta($post_id, $meta_box['name'].'_value') == "")
     add_post_meta($post_id, $meta_box['name'].'_value', $data, true);
  elseif($data != get_post_meta($post_id, $meta_box['name'].'_value', true))
     update_post_meta($post_id, $meta_box['name'].'_value', $data);
  elseif($data == "")
    delete_post_meta($post_id, $meta_box['name'].'_value', get_post_meta($post_id, $meta_box['name'].'_value', true));
  </code></pre>
  
  <p>How would i fix this to save all the checked checkboxes.</p>
  
  <p>Thanks in advance for any help</p>