using $_SESSION[' ']; to transfer data problem....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
grabber_grabbs
Forum Commoner
Posts: 60
Joined: Mon Oct 10, 2011 6:13 pm

using $_SESSION[' ']; to transfer data problem....

Post by grabber_grabbs »

thanks for helping here.

ok, i have my screen divided in 2 frames... one frame (called top) has one line. The other frame (called main) has all the rest of the screen. I want to make a little image in the top section to act like a zoom or a reducer of the main content. Like if i click on the little image, that would make the content of the main screen to show data without pictures.. if i click on the little image (in the top section again) that would do the opposite.... making the main screen to show the data with the picture.
So the little image is showing pictures or removing pictures.

So the main is showing differents things depending on what it find in a $_SESSION['variable'];
in my top frame, when i click the image, i change the value of the $_SESSION['variable']; and then i do a parent.frames[1].location.reload(); to reload the main.php

looks like when i reload the main, the main is like reading the $_SESSION['variable']; from the buffer or from the ram of the client computer.... and is not reading the new value from the top.php frame....
If i do click let say 4 or 5 times... it will eventually change and would work ok for one or two more time until it stop working like for 5 or 6 times again!!!
It really looks like it is not getting the value from the server but getting it from the cookie on the client side.

Or it is acting like, the server is not responding fast ennough, that the client side script is just reloading the page before the $_SESSION['variable'] has changed...
mikeashfield
Forum Contributor
Posts: 159
Joined: Sat Oct 22, 2011 10:50 am

Re: using $_SESSION[' ']; to transfer data problem....

Post by mikeashfield »

Why use frames instead of a div?
Hermit TL
Forum Commoner
Posts: 69
Joined: Mon Nov 21, 2011 12:16 am

Re: using $_SESSION[' ']; to transfer data problem....

Post by Hermit TL »

I had a problem similar to this before; however, I can not tell you how to fix it as the problem was in my PHP script. If you can post the script, maybe someone can help you figure out why it's not working as expected.
maxx99
Forum Contributor
Posts: 142
Joined: Mon Nov 21, 2011 3:40 am

Re: using $_SESSION[' ']; to transfer data problem....

Post by maxx99 »

Just to make it clear
Link (frame1) -> set session variable (frame1/php) -> reload frame 2 (from frame1/js) -> read session variable and load page (frame2)

Why do you even use frames? You can use ajax request to change content in another div?

Code: Select all

http://davidwalsh.name/basic-ajax-requests-mootools
Example

Code: Select all

http://davidwalsh.name/dw-content/moo-basic-ajax.php
If you're fixed on frames:
how do you set the session variable before you reload frame2?
Post Reply