Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

addition of two form fields

Guest
Jul 11, 2010 Jul 11, 2010

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

TOPICS
Server side applications

Views

572
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 11, 2010 Jul 11, 2010

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2010 Jul 11, 2010

Copy link to clipboard

Copied

LATEST

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>

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines