$_SESSION does not work to me...
$_SESSION does not work to me...
am 26.08.2007 23:25:49 von Zanna
Hi,
Another newbie question.
I'm using to do a test
$_SESSION["count"]++;
after a POST action, but evry time the page is reloaded $_SESSION is never
initialized... why?
Thanks
Re: $_SESSION does not work to me...
am 27.08.2007 00:34:21 von zeldorblat
On Aug 26, 5:25 pm, "Fabio" wrote:
> Hi,
>
> Another newbie question.
>
> I'm using to do a test
>
> $_SESSION["count"]++;
>
> after a POST action, but evry time the page is reloaded $_SESSION is never
> initialized... why?
>
> Thanks
Do you have session_start() at the beginning of your page?
Re: $_SESSION does not work to me...
am 27.08.2007 00:42:48 von Zanna
"ZeldorBlat" ha scritto nel messaggio
news:1188167661.871089.223050@k79g2000hse.googlegroups.com.. .
>
> Do you have session_start() at the beginning of your page?
>
mmm... you're right, thanks.
But I read somewhere that with $_SESSION it was useless to call
session_start() and others session functions... :(
session_start() never reset the $_SESSION, right?
I have to call it at evry page POST or I have to check if session was
already started and only if not I will call session_start()?
Thanks again ;)
Re: $_SESSION does not work to me...
am 27.08.2007 01:07:46 von zeldorblat
On Aug 26, 6:42 pm, "Fabio" wrote:
> "ZeldorBlat" ha scritto nel messaggionews:1188167661.871089.223050@k79g2000hse.googlegro ups.com...
>
>
>
> > Do you have session_start() at the beginning of your page?
>
> mmm... you're right, thanks.
> But I read somewhere that with $_SESSION it was useless to call
> session_start() and others session functions... :(
You're thinking of session_register()
>
> session_start() never reset the $_SESSION, right?
> I have to call it at evry page POST or I have to check if session was
> already started and only if not I will call session_start()?
>
Just call session_start() the top of every page. Otherwise the
session variables will not be available. If you do it once at the top
of the page you don't need to check if it's started every time you
want to access a session variable. Of course you could also enable
session.auto_start in php.ini -- but I wouldn't recommend that for a
variety of reasons.