title: How can i calculate 10 percent of a number entered in a text box and instantly show the result in another text box in php and html
body: <p>I need help in solving this problem. I have a text box that collects a figure. Now i can calculate 10% of that value and then add the result to the initial value from the textbox to get a final value with the 10% included. What i need help for is how do i display that final value in another text box without submitting and form. That is, as the value is entered in the first textbox, automatically the percentage is calculated and added to initial figure and the result outputted in the second textbox.</p>
  
  <p>the code to calculate the percentage is below:</p>
  
  <pre><code>&lt;?php
  $percentage = 10;
  $percentindecimal = $percentage / 100;
  $amountdue = ($percentindecimal * $amountneeded) + $amountneeded; 
  ?&gt;
  
  &lt;form&gt;
    &lt;input name="amountneeded" type="text"&gt;
    &lt;output name="amountdue" type="text"&gt;&lt;/output&gt;
  &lt;/form&gt;
  </code></pre>