title: How to retain the values in an array when submit button is clicked
body: <p>php newbie here. How do I retain the value of an array when I click the submit button? So this how the program works. The user will input a name and a seat number(between 1-25) and when the the user clicks submit button, the name will be added on the array and will be displayed on the table. It works for the first input but when i entered another name and seat number, the first input is deleted. Please help. </p>
  
  <pre><code>     //this is where the user will input...
       Student Name: &lt;input type="text" name="name" id="name"&gt;&lt;br&gt;
       Seat Number: &amp;nbsp;&lt;input type="text" name="seat" id="seat"&gt;&lt;br&gt;
      &lt;input type="submit" name="assign" value="Assign"&gt; &lt;?php echo $warning; ?&gt;
  
      //and this is my php code.
      &lt;?php
          $students = array_fill(0, 25, NULL);//this is to make an empty array with the size of 25.
          if(isset($_POST['assign'])){
              $student = $_POST['name'];
              $seat = $_POST['seat'];
  
              if($seat &gt; 25 || $seat &lt; 1){
                  $warning = 'Seat number does not exist.';
              }
              else{
                  $warning = '';
                  $students[$seat-1] = $student;
              }
          }
      ?&gt;
  
      //This code here is just a part of the HTML code for the table.  this is where the name will display.
      &lt;td id="box"&gt;&lt;?php echo $students[0]; ?&gt;&lt;/td&gt;
      &lt;td id="box"&gt;&lt;?php echo $students[1]; ?&gt;&lt;/td&gt;
      &lt;td id="box"&gt;&lt;?php echo $students[2]; ?&gt;&lt;/td&gt;
      &lt;td id="box"&gt;&lt;?php echo $students[3]; ?&gt;&lt;/td&gt;
      &lt;td id="box"&gt;&lt;?php echo $students[4]; ?&gt;&lt;/td&gt;
  </code></pre>