First off, there’s a problem with your array. Arrays can not have duplicate keys. So, only the first key will be saved. You need to change your form to something like this.
<input name="mainStageSatOrder[theband0][theid]" type="hidden" class="band-id" value="" />";
<input name="mainStageSatOrder[theband0][theorder]" type="hidden" class="band-order" value="" />";
<input name="mainStageSatOrder[theband1][theid]" type="hidden" class="band-id" value="" />";
<input name="mainStageSatOrder[theband1][theorder]" type="hidden" class="band-order" value="" />";
The array will look like this
$array = array(
'mainStageSatOrder' => array(
'theband0' => array(
'theid' => 1,
'theorder' => 5
),
'theband1' => array(
'theid' => 2,
'theorder' => 8
)
)
);
You don’t need a foreach loop while saving the meta data. You can instead save it as an array. WordPress will automatically serialize it for you.
$array = $_POST['mainStageSatOrder'];
update_post_meta( $postid, 'mainStageSatOrder', $array );
And, while retriving the values..
$data = get_post_meta($post->ID, 'mainStageSatOrder', true);
The returned $data
will be an array.