CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 user defined variables

Print topic Send  topic

Author Message
doug_mize

Posts: 12
Posted: 04/09/2008, 6:34 PM

Hello!

Stupid question:

Where in CCS do I define variables for use throughout a session? I need to pull a user# from a cookie and make it into a variable called $user so that I can use that in other functions and on other pages.

Also, I need to set a variable called $custom_list_name when a user inputs their custom list name into, and submits, my php form.

I've got the list name form working fine, in that it writes the proper record to the proper table, but I need the list name value as a variable ($custom_list_name) for use on other pages as well.

Any help would be great!

Doug
View profile  Send private message
CCT


Posts: 44
Posted: 04/10/2008, 11:15 AM

Hello, Doug.

In your case, I'd just directly use $_SESSION array. This array is already superglobal, so you won't need to declare your custom variable in every function, just write $_SESSION['user'] or $_SESSION['custom_list_name']. You'll just once assign that session variables from user form (seems like Record's "AfterInsert/AfterUpdate" event is good place for this).

Instead of working with $_SESSION directly, you can also use CCGetSession/CCSetSession functions.

Best regards,
Frank.
_________________
Get more CodeCharge Studio builders at http://codechargetools.com
View profile  Send private message
calfaro

Posts: 6
Posted: 06/17/2008, 8:00 PM

Is there another way to do this? I need to declare a variable inside a grid as custom code and then be able to access it somewhere else on the page outside the grid. I guess session would work, but I don't really need it for the whole session, only for a single php script.
View profile  Send private message
wkempees


Posts: 1679
Posted: 06/18/2008, 4:07 AM

Page AfterInitialize, declare the variable either in Code or through Action Declare variable.

Any where you want to use it (display or alter it) either use Code or Action.
In Short: (declaring a var DeKemp set it initaly to 123.
Page AfterInitialize:
  
global $DeKemp;  
$DeKemp = 123;  

Any other event :
  
global $DeKemp;  
  
echo $DeKemp;  
$DeKemp +- 8;  
  
and so on.

Walter



_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.