title: storing data in an array in php with multiple submission and eco self
body: <p>Trying to print data from multiple submission, I want the names and roll numbers to get printed/passed to another form. These data will generated from several submissions. In the following code, only the last submission data is getting printed. Where am I going wrong.</p>
  
  <p>`</p>
  
  <pre><code>&lt;?php
  $name[] = $_POST['name'];
  $rollno[] = $_POST['rollno'];
  $arrlength=count($name);
  for($x=0;$x&lt;$arrlength;$x++)
    {
    echo $name[$x]." - - - - - -".$rollno[$x] ;
    echo "&lt;br&gt;";
    }
  ?&gt;
  &lt;form id="form1" name="form1" method="post" action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;"&gt;
  &lt;table width="100%" border="0" cellspacing="2" cellpadding="2"&gt;
    &lt;tr&gt;
      &lt;td&gt;Name&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="name" id="textfield" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Roll No.&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="rollno" id="textfield2" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;input type="submit" name="button" id="button" value="Submit" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>`</p>