How to pass username between forms

Hello,

I’m a new user to SC and currently i have doubts in passing variables between forms. I have a log in form that redirects to another form that instructs users to enter some data. The form where the users enter data should show only the name of logged user in one of the fields. Currently i am using a straight-away lookup from the user tables. This shows all the users. How can i accomplish this.

Thanks.

Parameters are useually passed by a global variable. You can recognize these as variables between []. If you look in the generated loginmodule you will see that the variables you need are registered by sc_set_global, a deprecated function. But these variables can be used anywhere if you set them between [].


	sc_set_global($usr_login);
	sc_set_global($usr_priv_admin);
	sc_set_global($usr_name);
	sc_set_global($usr_email);

In your case you can access the username by the using [usr_name] in your other applications. This global variable can also be used in header or footer, ie: welcome: [usr_name]

Thanks aducom. Will try this

Some extention to this, I need to pass an array between app.

array (size=9)
0 =>
array (size=2)
0 => int 175
1 => string ‘a’ (length=1)
1 =>
array (size=2)
0 => int 202
1 => string ‘b’ (length=1)
2 =>
array (size=2)
0 => int 190
1 => string ‘c’ (length=1)
3 =>
array (size=2)
0 => int 203
1 => string ‘d’ (length=1)

When using sc_set_global($players) the global variable is reated but contains ‘array’.

So how can i transfer this (a multidimentional array) between apps.

BR
Danny

[QUOTE=rodiusd;27133]Some extention to this, I need to pass an array between app.

When using sc_set_global($players) the global variable is reated but contains ‘array’.

So how can i transfer this (a multidimentional array) between apps.

BR
Danny[/QUOTE]

Don’t use sc_set_global as this is a deprecated function. You just declare your global by puting them between brackets.

[myarray]= etc.

Hello,

I’m a new user to SC and currently i have doubts in passing variables between forms. I have a log in form that redirects to another form that instructs users to enter some data.

You can pass data using global variables. In SC you put them between []. If you redirect you can set the variables in the sc_redir function. Best way to start is by following the video tutorial on the main website of SC describing this.