title: How to dynamically change webpage content based on input fields
body: <p>I have a webpage that I am building, and I want it to update some text on the page as a couple input values are changed. Basically, here is my algorithm I think it should follow however I'm not exactly too sure. (to clarify I am using PHP as well) but I dont have any further knowledge of any other languages besides HTML and CSS and a small amount of javascript obviously).</p>
  
  <pre><code>Open Amount: $&lt;input type="text" name="openamount"&gt;&lt;br /&gt;
  Close Amount: $&lt;input type="text" name="closeamount"&gt;&lt;br /&gt;
  &lt;script type="text/javascript"&gt;
      document.write("Profit $" + document.getElementsByName("openamount").value - document.getElementsByName("closeamount").value);
  &lt;/script&gt;
  </code></pre>
  
  <p>Couple of problems, first when the page loaded it gives me a few undefined things when I would rather it just start off as blank, second it doesn't update as I put content into the input fields. On top of all that though, I need the profit actually sent as one of the values in the POST form. Thanks for any help in advance.</p>