This topic is locked

Set $_SESSION from field value

12/9/2013 1:14:25 AM
PHPRunner General questions
S
seedavidwork author

I have fields

'subscope_bujvend' and

'subscope_bujacc'
with default value for 'subscope_bujvend' set to $_SESSION['test_value']
I am trying to set $_SESSION['test_value']=( the current value of 'subscope_bujvend' ) with no luck

Using $_SESSION['test_value']=$vales['subscope_bujvend']

and $_SESSION['test_value']=$data['subscope_bujvend'] I get nothing in the 'subscope_bujacc' field but when I try

$_SESSION['test_value']="1" I get the value 1
I've tried adding code to both the Before process and Before record added events with no luck
Ultimately I want to set a session variable where $_SESSION['test_value']=(some value from a field in the record)*(some other value from a different field)

C
cgphp 12/9/2013

In the "Before record added" event, add this code:

$_SESSION['test_value'] = $values['subscope_bujvend'];
S
seedavidwork author 12/9/2013

I tried this code where you suggested in "Before record added" and I did not see any value in the 'subscope_bujacc' field during a record add or edit.
To restate my problem, I am trying to set the numeric value of one field from the stored numeric value in another field of the same record when updating.
Thanks for the help,

Sergey Kornilov admin 12/9/2013

The suggestion provided by Cristian is 100% correct. I guess you either have some sort of syntax error in your code or you looking for something else. There is a great bit of confusion between default values, session variables and calculated fields in your post.