title: getting a field value in html form without submitting the form
body: <p>i would like to ask if it is possible to get a value from a html form without submitting the form? i cant get this to work in html or php, or maybe i'm missing something. please help. see my working code below:</p>
  
  <pre><code>&lt;FORM  name="myForm" action="confirmsold.php" method="post" onsubmit="return validateFormLay()"&gt;
      &lt;table border=0 width="550" cellspacing=1 cellpadding=3 bgcolor="#353535" align="center"&gt;
  &lt;tr&gt;
          &lt;td bgcolor="#ffffff"&gt;Price Basis:&lt;/td&gt;
          &lt;td bgcolor="#ffffff"&gt;
          &lt;?php
          $connect = mysqli_connect("localhost","root","ilovegym") or die(mysqli_connect_error());
  
          mysqli_select_db($connect, "laborsa") or die(mysqli_error());
  
          $sql = "SELECT Cash_Price,3months,6months,12months,18months FROM itemmaster where Item_Number='".$_SESSION['ITEM#']."'";
          $result = mysqli_query($connect,$sql);
  
          echo "&lt;select name='basis'&gt;";
          while ($row = mysqli_fetch_array($result)) {
          echo "&lt;option value='" . $row['Cash_Price'] ."'&gt;" . $row['Cash_Price'] ." - ".CashPrice."&lt;/option&gt;&lt;option value='" . $row['3months'] ."'&gt;" . $row['3months'] ." - ".ThreeMonths."&lt;/option&gt;&lt;option value='" . $row['6months'] ."'&gt;" . $row['6months'] ." - ".SixMonths."&lt;/option&gt;&lt;option value='" . $row['12months'] ."'&gt;" . $row['12months'] ." - ".TwelveMonths."&lt;/option&gt;&lt;option value='" . $row['18months'] ."'&gt;" . $row['18months'] ." - ".EighteenMonths."&lt;/option&gt;";
          }
          echo "&lt;/select&gt;";
          ?&gt;  
          &lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
          &lt;td bgcolor="#ffffff"&gt;Downpayment:&lt;/td&gt;
          &lt;td bgcolor="#ffffff"&gt;&lt;INPUT type="TEXT" name="downpayment" size="12" maxlength="11" onkeypress="if ( isNaN( String.fromCharCode(event.keyCode) )) return false;"&gt;&lt;/INPUT&gt;&lt;/td&gt;
      &lt;/tr&gt;
  
      &lt;tr&gt;
          &lt;td bgcolor="#ffffff"&gt;Balance:&lt;/td&gt;
          &lt;td bgcolor="#ffffff"&gt;&lt;INPUT type="TEXT" name="laybalance" size="12" maxlength="11" onkeypress="if ( isNaN( String.fromCharCode(event.keyCode) )) return false;"&gt;&lt;/INPUT&gt;&lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>
  
  <p>as you can see, i need to choose from the drowdown a payment basis, then ill input a downpayment. how can i make the balance field show the balance automatically? i only need to subtract the basis-downpayment, difference will be put in the balance field.</p>
  
  <p>Please help anyone.
  Thank you.</p>