Copy link to clipboard
Copied
I have two form fields getting their record from a data base, they both get numbers, and in the same form, I would like to add a third field, and then get it value by putting the two other fields together,
Here is what I want:
I have:
x = field one (get value from database, Number)
y = field two (get value from database, Number)
I would to have as final result:
z (form field three) = x + y
Java or whatever else that work, (I am using Dreamweaver CS5)
thanks
Copy link to clipboard
Copied
Please explain how the 2 fields (x, y) are getting their values. Are they populating a list box that the user selects a value from, or just a single value from the recordset? If the latter, then you can just add a calculated field to the recordset:
Select x, yb, x + y as total from MyTable
If the former, then you need to tell us how the sum will be used.
Copy link to clipboard
Copied
I assume that you are working with a server side code in which case just use that.
For instance, if using PHP the example would look like
<?php /* the following values will be obtained from the database*/
$rowDatabase['x']=53;
$rowDatabase['y']=104;
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head><body>
<input name="x" type="text" readonly="true" value=<?php echo $rowDatabase['x']; ?> /> +
<input name="y" type="text" readonly="true" value=<?php echo $rowDatabase['y']; ?> /> =
<input name="z" type="text" readonly="true" value=<?php echo $rowDatabase['x']+$rowDatabase['y']; ?> />
</body>
</html>