> I've had some problems with the scope of a variable.
> I need a variable which can maintain it's value throughout all the pages
> of my web-site.
> I've tried to define a variable in "code-global". It worked fine, but it
> seems that when I retrieve a new page it loses its previous value and it
> is initialized with its initial value declared in "code-global" .
> In other words how can I "obtain" a "global" variable.
> I've also tried with environment variables (putenv,getenv) but this
> also looses its value (I verified this also with phpinfo()).
> As I know in such a case I can use cookies, but I do not want .
This is not a Midgard (or even a PHP) problem -- it's just the way HTTP
works. Every request to a webserver is an event without external reations.
Keeping state is one of the more challenging things since HTTP was
designed to be stateless. Even logging in (a misnomer BTW) doesn't create
any kind of state. The entire logonm process is performed for every single
page request.
What you want is a session, and there are several ways to get that. One is
cookies, as you mentioned, another is requiring a login and store
username-related session info server-side, and a third one is to have
hidden values in a form and make each request a form action.
Emile
--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org
To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]