I'm building simple form
template.php
<div class="form-group relocate">
<label for="contact_method"><?php _e('Best Contact Method', 'jobboard') ?></label>
<?php
$contact_method = get_post_meta($resume_id, 'resume_contact_method', false);
// $contact_method = explode( ',', $contact_method );
var_dump($contact_method);
?>
<ul>
<li class="checkbox-inline">
<input type="checkbox" id="resume_contact_method" name="resume_contact_method[]" value="email" <?php if($contact_method){echo (in_array('email', $contact_method)) ? 'checked="checked"' : ''; } ?>><label for="resume_contact_method_email"><?php _e( 'Email', 'jobboard' ); ?></label>
</li>
<li class="checkbox-inline">
<input type="checkbox" id="resume_contact_method" name="resume_contact_method[]" value="phone" <?php if($contact_method){echo (in_array('phone', $contact_method)) ? 'checked="checked"' : ''; } ?>><label for="resume_contact_method_phone"><?php _e( 'Phone', 'jobboard' ); ?></label>
</li>
</ul>
</div>
function.php
for($i=0; $i<sizeof($_POST['resume_contact_method']); $i++){
update_post_meta( $resume_id, 'resume_contact_method', $_POST['resume_contact_method'][$i] );
}
My code issue, if i try to save data checkbox, form input just saving last data clicked. Can anyone tell me where have I done a mistake ?