Without looking at your code, this is how I send an array in a form using the hidden input tag.
Turn the array into a string using join():
Put that in the hidden field.
To get an array back in the php use the explode:
$MyArray = explode(",", $string); <= This is php