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:
<FORM name="myForm" action="confirmsold.php" method="post" onsubmit="return validateFormLay()">
<table border=0 width="550" cellspacing=1 cellpadding=3 bgcolor="#353535" align="center">
<tr>
<td bgcolor="#ffffff">Price Basis:</td>
<td bgcolor="#ffffff">
<?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 "<select name='basis'>";
while ($row = mysqli_fetch_array($result)) {
echo "<option value='" . $row['Cash_Price'] ."'>" . $row['Cash_Price'] ." - ".CashPrice."</option><option value='" . $row['3months'] ."'>" . $row['3months'] ." - ".ThreeMonths."</option><option value='" . $row['6months'] ."'>" . $row['6months'] ." - ".SixMonths."</option><option value='" . $row['12months'] ."'>" . $row['12months'] ." - ".TwelveMonths."</option><option value='" . $row['18months'] ."'>" . $row['18months'] ." - ".EighteenMonths."</option>";
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td bgcolor="#ffffff">Downpayment:</td>
<td bgcolor="#ffffff"><INPUT type="TEXT" name="downpayment" size="12" maxlength="11" onkeypress="if ( isNaN( String.fromCharCode(event.keyCode) )) return false;"></INPUT></td>
</tr>
<tr>
<td bgcolor="#ffffff">Balance:</td>
<td bgcolor="#ffffff"><INPUT type="TEXT" name="laybalance" size="12" maxlength="11" onkeypress="if ( isNaN( String.fromCharCode(event.keyCode) )) return false;"></INPUT></td>
</tr>
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.
Please help anyone. Thank you.