Assign key value pair in each loop

Assign key value pair in each loop

I'm trying to assign key/value variable pairs to an array w/in an each loop, but keep getting undefined on line #6 on the second pass of the loop. My key (mylabel) & value (myvalue) are extracted from form inputs.  I'm going to post this to a php file to send out the responses.

  1. var arck = 0;
  2. $('all my form targets').each(function() {
  3.   var mylabel = some text;
  4.   var myvalue = some text;
  5.   if (arck == 0) {var post_data = new Array(); arck = 1}
  6.   post_data[mylabel] = myvalue;  
  7. });

Simple example of array, after looping through 2 inputs:
  1. post_data [
  2.       {name : some text},
  3.       {email : some text2}
  4. ]

How do I assign the key/value pairs ?