I am quite new to php and wordpress but have programming knowledge.
i am attempting to save data from these metaboxes in metabox plugin by creating a new custom metabox. this is my code

 $tour_rates = get_post_meta( $post->ID, $id, true ) ? maybe_unserialize(get_post_meta( $post->ID, $id, true )) : false;
    if ($tour_rates){
                foreach ( $tour_rates as $options => $option ) {
                    $key = 1        
                    $html .= '<tr class="rate-line">';
                    $html .= '<td>';
                    $html .= '<span>Opt ' . ($options+1) . '</span>';
                    $html .= '<input type="hidden" name="' . $id . '[]" class="rwmb-text" size="30" value="">';
                    $html .= '</td>';                       
                    $html .= '<td><input type="text" name="pax_date_'.$key.'[]" class="rwmb-date" size="3" value="'.$option[$key-1].'"></td>';
                    $html .= '<td><input type="text" name="pax_price_'.$key.'[]" class="pax-price" size="3" value="'.$option[$key-1].'"></td>';
                    $html .= '</tr>';
                }   

Now in the save function i have this code. i am able to save only pax-price and not the date along with pax-price. need help and thanks in advance for all your help

static function save( $new, $old, $post_id, $field )
        {
            $name = $field['id'];
            $tour_rates = array();
            foreach ( $_POST[$name] as $k => $v ) {
                $tour_rates[$k] = array(
                    $_POST['pax_price_1'][$k],
                    $_POST['pax_date_1'][$k],
                );
            }
            $new = maybe_serialize( $tour_rates );
            update_post_meta( $post_id, $name, $new );
        }

Read more here: Unable to save custom metabox data from metabox plugin


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , ,

Wordpress related questions and answers: