title: Use form values to dynamically calculate another value on same page
body: <p>I am trying to use the form values to dynamically calculate another value on the same page. </p>
  
  <p>I have two tables:</p>
  
  <ol>
  <li>with the input form</li>
  <li>Where I want to use the input form values dynamically before posting.</li>
  </ol>
  
  <p>I have already used php but it doesn't work as I have to submit in order to get the values. I am not really familiar with j script and ajax, however i heard it is possible to do it using these. Let me know what you think is the best solution. thanks in advice.</p>
  
  <p>Here the example:</p>
  
  <p></p>
  
  <pre><code>&lt;table&gt;&lt;form name="form1" method="post" action="results.php"&gt;
      &lt;tr&gt;
          &lt;td&gt; &lt;/td&gt;&lt;td&gt; a &lt;/td&gt;&lt;td&gt; b &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt; Line 1 &lt;/td&gt;&lt;td&gt;&lt;input name="a1" type="number"&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="b1" type="number"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt; Line 2 &lt;/td&gt;&lt;td&gt;&lt;input name="a2" type="number"&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="b2" type="number"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;input type="submit" name="Submit" value="Submit"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/form&gt;&lt;/table&gt;
  
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt; Dynamic Result &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt; a1/b1 (to be calculated dynamically)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt; a2/b2 (to be calculated dynamically) &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p></p>