title: Dynamic input form php
body: <p>I am making a dynamic PHP form that interacts with a mySQL database for entering the scores of students on different assignments. So far I have successfully connected to the database and accessed the necessary data. The following code displays for each student first, their name, and then an empty text input box where the user enters the score said student earned on the assignment.</p>
  
  <pre><code>&lt;?php if(isset($_POST["beginScoring"]) || isset($_POST['submitScores'])){
          $result = $connection-&gt;query("SELECT id, firstname, lastname FROM student ORDER BY lastname");
          if(!$result)
          {
              echo "Query Failure";               
          }
          else 
          {
              $foo = array();
              $c = 0;
              echo "&lt;tr&gt;&lt;td&gt;Last Name&lt;/td&gt;&lt;td&gt;First Name&lt;/td&gt;&lt;td&gt;Points Earned&lt;/td&gt;&lt;/tr&gt;";
              while ($row = $result-&gt;fetch_assoc())
              {
                  echo "&lt;tr&gt;&lt;td&gt;$row[lastname]&lt;/td&gt;&lt;td&gt;$row[firstname]&lt;/td&gt;";     
                  ?&gt;
                  &lt;td&gt;&lt;input type="text" size=8 name="" id="" value=""/&gt;&lt;/td&gt;&lt;/tr&gt;  &lt;!-- I can maybe use an array to store scores . . . --&gt;
                  &lt;?php
              }
          }
      ?&gt;
  </code></pre>
  
  <p>The thing I am having issues with is how do I name the text input. Since there are going to be an undetermined amount of text boxes, I can't use a single static name for the input item, right? What would be a good way to name the text boxes so that I can easily access them using the POST array?</p>