I've got a very odd problem occuring which I'm hoping someone can help me out with.
Simply put, I'm setting a session variable, resetting it but then finding the new value is not being "remembered".
The flow should be something like this:
Page 1 (set HTTP_SESSION_VARS['P'] = 10) --> using post or get, send new value for P
Page 2 (read HTTP_SESSION_VARS['P'] & reset it to 13) --> using post or get, send new value for P
Page 2 (read HTTP_SESSION_VARS['P'] & reset it to 37) --> (continue)
Here's the clues/things I've tried to get to where I am (which is very confused/frustrated):
* I have verified that cookies are working and the session ID is not changing from page to page.
* I have turned register_globals off to prevent potential problems.
* I put this code BEFORE and AFTER the manipulations of the vars so I can see the session values and the result of the manipulations:
print("<pre>");
print_r($_SESSION);
print("</pre><br>");
* here is the code to manipulate the var:
* The function Validate_Vars sets $CurrentP to the value of P_X in this order if present: $P_G (get), $P_P (post), $P_D (default).PHP Code:$P_D = 1; // a default value
$P_G = $HTTP_GET_VARS['P'];
$P_S = $HTTP_SESSION_VARS['P'];
$P_P = $HTTP_POST_VARS['P'];
$CurrentP = Validate_Vars($P_G, NULL, $P_P, $P_D);
$HTTP_SESSION_VARS['P'] = $CurrentP;
* Here's what the test code says on page 1 (what I expect):
* Then I use a POST method to send the value of P=10 and get this (not what I expect):Code:Array ( ) Array ( [P] => 1 )
* But if at any time send a GET method to set P=10, it "sticks" like this (what I expect):Code:First run as POST: Second run as POST: Array Array ( ( [P] => 1 [P] => 1 ) ) Array Array ( ( [P] => 10 [P] => 10 ) )
* As I understand the code I've written, the GET is working properly:Code:First run as GET: Second run as GET: Array Array ( ( [P] => 1 [P] => 10 ) ) Array Array ( ( [P] => 10 [P] => 10 ) )
(1) Print to screen values of session value [P]
(2) Check if there's been a POST or GET and change the session value [P] to it
(3) Print to screen the value of session value [P]
* And the POST is too in that it is printing the session value, changing it and printing it but for some reason, it is not "remembering" it.
Any suggestions for where I can go from here to figure this out?
Many thanks!
EZ


LinkBack URL
About LinkBacks



Reply With Quote
)

Bookmarks