PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
IBM developerWorks
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old July 9th, 2002, 07:27 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
reload problem

If I use the $_SESSION superglobal (PhP 4.1 >) to define the following in page1.

session_start();
$_SESSION['count']="1";
header("Location: page2");
....

page2 is then called using the header.

where page2 simply does:

session_start();
echo $_SESSION['count'];
...

Outputs:

1

If I hit the reload button, $_SESSION['count'] is empty.

I'm not sure if this is suppose to happen, but is there a way to retain the contents within the $_SESSION['count'] variable after a reload?

Thanks.

Reply With Quote
  #2  
Old July 9th, 2002, 08:00 PM
greggory greggory is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Reims, France
Posts: 82 greggory User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: reload problem

In order to use 'count' as a session variable, you have to call :

session_register( "count" );

Before using it.

Reply With Quote
  #3  
Old July 9th, 2002, 09:44 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: reload problem

The new specification at php.net indicates the following for PhP 4.1 and higher:

Caution
If you are using $HTTP_SESSION_VARS/$_SESSION and disable register_globals, do not use session_register(), session_is_registered() and session_unregister().

http://www.php.net/manual/en/ref.session.php


In this case I'm using the autoglobal _$SESSION superglobal (since as per recommendation my register_globals is disabled in the php.ini file) to access the elements of it from another script.

Thanks.

Reply With Quote
  #4  
Old July 10th, 2002, 12:41 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: reload problem

Ah. Sorry found the problem. I was calling session_destroy() at the end of the script. No wonder.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > reload problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway