FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Re: Counter reset or not?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Counter reset or not? [message #182485] Thu, 08 August 2013 04:06 Go to previous message
Richard Damon is currently offline  Richard Damon
Messages: 58
Registered: August 2011
Karma:
Member
On 8/7/13 7:38 PM, Twayne wrote:
> Hi all,
>
> I'm confused; this code isn't working and I don't know why; perhaps you
> can tell me or at least point me in the right direction:
>
> <code>
> if($_SESSION["cntr"] > "0") {
> echo "Count is now : " . $_SESSION["cntr"]." ";
> }
> ELSE {
> $_SESSION['cntr']="0";
> $cntr=$_SESSION['cntr'];
> echo "Counter : " . $cntr."<br />";
> }
> </code>
>
> OK: This code is on the first of 3 PHP form pages. The ELSE works fine.
> If the count is zero, the initial count of "0" is echoed properly.
>
> But if the code is 1 or greater, set on one of the two succeeding pages,
> it still runs the ELSE code and insists on returning the value of "0".
>
> I'm not using session_destroy, nor an I using die(), exit() or anything
> else that should bother the SESSION var.
> 2. If the counter advances to 1 or more, however, when I send the user
> back to the first page (where the above code resides), it still prints
> the ELSE portion of the code, NOT what the SESSION var has been set to
> (1 or greater).
>
> I'm confused!! What am I doing wrong?
>
> TIA,
>
> Twayne`
> O

Have you called session_start() (or set session.auto_start) ?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: fetching value from related multiple rows & columns in PHP SQL
Next Topic: Please evaluate my cache-control & pragma etc. code
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 05:29:34 GMT 2024

Total time taken to generate the page: 0.07575 seconds