I am trying to use the form values to dynamically calculate another value on the same page.
I have two tables:
- with the input form
- Where I want to use the input form values dynamically before posting.
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.
Here the example:
<table><form name="form1" method="post" action="results.php">
<tr>
<td> </td><td> a </td><td> b </td>
</tr>
<tr>
<td> Line 1 </td><td><input name="a1" type="number"></td><td><input name="b1" type="number"></td>
</tr>
<tr>
<td> Line 2 </td><td><input name="a2" type="number"></td><td><input name="b2" type="number"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</form></table>
<table>
<tr>
<td> Dynamic Result </td>
</tr>
<tr>
<td> a1/b1 (to be calculated dynamically)</td>
</tr>
<tr>
<td> a2/b2 (to be calculated dynamically) </td>
</tr>
</table>
jscript!==javascript,ajax===javascript, and yes, javascript is a possible solution. You should read up on it.