Your code works fine on my FreeBSD box running php 4.0.4pl1 but not one running php 4.0.6 ... May explain your linux issues? i.e. versions of php ...
-----Original Message----- From: Richard Baskett [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 23, 2002 3:37 PM You only need to register the variable once when you initiate the session. Also as of php 4.1 I believe you do not have to register your session vars you can just acccess them like $_SESSION['counter']: http://www.php.net/manual/en/ref.session.php Basically what I see you're doing is reregistering the variable on each page which initializes it as 0 and so when you do $counter++ you're always going to get 1.. > test.php: > <?php > session_start(); > session_register('counter'); > $counter++; > echo("You have visited this page $counter times.\n"); > ?> > <a href="test2.php">click here</a> > > test2.php: > <?php > session_start(); > session_register('counter'); > $counter++; > echo("You have visited this page $counter times.\n"); > ?> > <a href="test.php">click here</a> > > Shouldn't this hold the same counter variable for both pages? It > works fine on my linux box, but on the FreeBSD box, $counter is always > 1. I think that if I could get something like this script working, > then the shopping cart would also work. Sorry for the long message! > Any help would be greatly appreciated. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]