|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
RE: reload problem
In order to use 'count' as a session variable, you have to call :
session_register( "count" ); Before using it. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
RE: reload problem
Ah. Sorry found the problem. I was calling session_destroy() at the end of the script. No wonder.
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > reload problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|