Function saves and prints only one value from array. how it can be fixed?
<p>I have got a function which allows me to save droped items for a loop inside form. Here is <a href="https://jsfiddle.net/montel388/ny1n9gm0/3/" rel="nofollow">sample</a> with two processes. What i want to do is to print saved values on the next page after submitting the form.</p>

<p>So again main idea, is that after choosing number of processes on first form user proceeds to the second form where he can drop items for each row in the loop. Then he can submit it by pressing save button and system should print saved values for each process. 
I found a way to break an array for each process by using this:</p>

<pre><code>var LISTOBJ = {
    saveList: function() {
        $(".proc").each(function() {
          var listCSV = [];
          $(this).find("li").each(function(){
              listCSV.push($(this).text());
          });
          $("#output").append("&lt;p&gt;"+listCSV.join(", ")+"&lt;/p&gt;");
          //$(".hiddenListInput").val(listCSV);
              console.debug(listCSV);
        });
    }
}
</code></pre>

<p>And its working fine, it prints a list of saved values for each process, however when I am trying to print it on the new page after submitting form using <code>$(".hiddenListInput").val(listCSV);</code> it displays only last saved value. 
Here is my form:</p>

<pre><code>&lt;form class="formcss" method="POST" action="test2.php"&gt;
&lt;?php 
    $len=2;
    for($y=0;$y&lt;$len;$y++)
    {
?&gt;  
    &lt;div class='proc'&gt;
     &lt;label&gt;Process:&lt;/label&gt;
      &lt;span&gt; &lt;/span&gt;
      &lt;br /&gt;
      &lt;div class="leader"&gt;
        &lt;label&gt;Leader:&lt;/label&gt;
        &lt;div class="ui-widget-content"&gt;
          &lt;div class="projLeader"&gt;
            &lt;ol&gt;
              &lt;li class="placeholder" name="leader[]"&gt;&lt;/li&gt;
              &lt;input type="hidden" name="leader[]" class="hiddenListInput" /&gt;
            &lt;/ol&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;


&lt;?php
    }                   
?&gt;  
&lt;div class="row"&gt;
      &lt;input type="submit" id="savebutton" style="margin-top:25px;" name="submit" class="button" value="Save" onclick="userSubmitted = true;" /&gt;
&lt;/div&gt;
    &lt;div id="output"&gt;&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>And test2.php where i want to print saved array:</p>

<pre><code>    $procleader=$_POST['leader'];
    print_r ($procleader);
</code></pre>