no, no database is needed.
the calculation is done using basic math in php.
look at my example.
In my example, i am using 2 form elements. element1 and element2:
<input type="text" name="element1" id="element1" />
<input type="text" name="element2" id="element2" />
this line casts the value of element1 to a variable named var1 (it assigns 0 if the value is blank):
$var1 = (isset($_POST['element1']))?intval($_POST['element1']):0;
this line casts the value of element2 to a variable named var2 (it assigns 0 if the value is blank):
$var2 = (isset($_POST['element2']))?intval($_POST['element2']):0;
this line adds the 2 together using simple addition:
$theSum = ($var1 + $var2);
see this page for basics on PHP math:
php_operators.asp