title: How can I dynamically add input fields to a form?
body: <p>I'm not much of a web programmer, but I'm creating a simple web app that has a form where the user can enter a series of points (x,y,z) but I don't know how many the user is going to enter. I don't want to guess the probable maximum (100 maybe?) and put 100 fields on the form because it would look ugly. What's the easiest way to add more fields (or unhide fields) as the user enters data without contacting the server.</p>
  
  <p>Currently I'm just using html &amp; php, but I assume to do this I'll need javascript?</p>
  
  <p>Currently my code looks like this, as the user enters data, I want another row to appear.</p>
  
  <pre><code>&lt;form action="edit.php" method="post"&gt; 
    &lt;table border=1&gt; 
      &lt;tr&gt; 
        &lt;td&gt; 
        &lt;td&gt;X
        &lt;td&gt;Y
        &lt;td&gt;Z
      &lt;/tr&gt; 
      &lt;tr&gt; 
        &lt;td&gt;1&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=x1 size=10 value="0.4318"&gt;&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=y1 size=10 value="0.0000"&gt;&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=z1 size=10 value="0.1842"&gt;&lt;/td&gt; 
      &lt;/tr&gt; 
      &lt;tr&gt; 
        &lt;td&gt;2&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=x2 size=10 value="0.4318"&gt;&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=y2 size=10 value="0.0000"&gt;&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=z2 size=10 value="-0.1842"&gt;&lt;/td&gt; 
      &lt;/tr&gt; 
      &lt;tr&gt; 
        &lt;td&gt;3&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=x3 size=10 value="-0.3556"&gt;&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=y3 size=10 value="0.0000"&gt;&lt;/td&gt; 
        &lt;td&gt;&lt;input type=text name=z3 size=10 value="0.1636"&gt;&lt;/td&gt; 
      &lt;/tr&gt; 
      ... I want more to appear here...
    &lt;/table&gt; 
    &lt;button name="submit" value="submit" type="submit"&gt;Save&lt;/button&gt; 
  &lt;/form&gt; 
  </code></pre>
  
  <p>Any idea the easiest way? Thanks...</p>