 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
PaulGrimshaw
Joined: 06 Mar 2006 Posts: 6
|
Posted: Wed Mar 08, 2006 12:44 pm Defining a variable once per visit? |
|
|
|
Hi,
I need to define a variable once per visit to my site and then later on I will be changing it in another script (for tracking positions of menus).
I can not use frames etc so each time the page changes, the variable gets wiped again (as I am resetting it by defining it everytime).
Is there some way of adding a check to see if a variable exists, if so, do nothing. If it doesnt exist, then define it?
Thanks,
Paul. |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8748 Location: Castle Pines North, CO USA
|
Posted: Wed Mar 08, 2006 1:13 pm |
|
|
|
|
Moved to other languages
Thanks!
-Corey |
|
chrisxkelley
Joined: 07 Dec 2004 Posts: 246
|
Posted: Fri Mar 10, 2006 6:44 pm |
|
|
|
what language?
in php I would use a session variable, something like this:
| Code: |
<?
$track = $_SESSION['track'];
if (!$track){
$_SESSION['track'] = "Some value";
} else {
print 'The variable has already been set!';
}
?>
|
that will chack to see if the session variable exists, and if not, it will set the session variable $track to "Some Value". and if it already exists, it will just print an already been set message. |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|