cannot put new string into array
<p>I have a form when the user types something in, it will appear on the screen. I kept the text that the user typed in a variable called <code>$output</code>, then I tried to put each <code>$output</code> into an array called <code>$arrayText</code>, my objective is to have the user type in something and click a button, then the user's text appears on the screen and when he tries for the second time, the first text is still there while the new one will be on the next line. However, it works only for the first time. For the second time, it replaces the second text with the old one, here is my code
    

<pre><code>if (isset($_POST['putContents'])) { 
  $output = $_POST['contents'];
  test();

}
function test()
{
static $arrayText = array();
    global $output;
    $arrayText[]= $output;
    for($i = 0; $i &lt; count($arrayText); $i++){
    echo $arrayText[$i];
    echo "&lt;br&gt;";
  }
}

}

?&gt;
</code></pre>

<p>thanks for any help in advance</p>
