This topic is locked

Add Page - Simple Addition from 3 Text Field

4/29/2010 3:54:10 PM
PHPRunner General questions
K
kutch author

Hi I'm a first time user of PHP Runner and this is my first post as well in forum.
I just want to make a simple additions, here are the following;
Field_1 = 10 [Text Field]

Field_2 = 10 [Text Field]

Field_3 = 10 [Text Field]

Field_Total = 30 [Text Field] This must be automatic or button will do.
Can anyone guide me where to start?
I've been reading this link

http://www.asprunner.com/forums/topic/13678-how-to-calculate-values-on-the-fly/

and

http://xlinesoft.com/phprunner/docs/how_to_calculate_values_on_the_fly.htm
Both them is no good for me.
Thanks

A
ann 4/30/2010

Kutch,

You can use "Before record added" or "Before record updated" events or both on the Events tab.

Here is a sample code:

$values["field_total"]=$values["field_1"]+$values["field_2"]+$values["field_3"];
S
swanside 4/30/2010



Hi I'm a first time user of PHP Runner and this is my first post as well in forum.
I just want to make a simple additions, here are the following;
Field_1 = 10 [Text Field]

Field_2 = 10 [Text Field]

Field_3 = 10 [Text Field]

Field_Total = 30 [Text Field] This must be automatic or button will do.
Can anyone guide me where to start?
I've been reading this link

http://www.asprunner.com/forums/topic/13678-how-to-calculate-values-on-the-fly/

and

http://xlinesoft.com/phprunner/docs/how_to_calculate_values_on_the_fly.htm
Both them is no good for me.
Thanks


You could do it in your sql
like

(select Field_1+Field_2+Field3) as Field_Total
Now what ever is in the three fields will be added together.