views:

30

answers:

1

Hello.

Im standing out with a issue, that the SESSION variable is "showing" before its defined..

Index.php is my site, where there is a design and inside that there is a frame. Now, index.php have this:

<div id='message2' onclick="closeNotice2()" style="display: none">
<? echo $_SESSION["user_message_123456"]; ?>
</div>

Inside the frame, there is a insert.php that stores data to user_message_123456.

Now before it has been stored, it will show undefined.. but after it has been stored, it will still show at undefined, UNTIL you refresh the page..

But, i want to do so, when you have stored the session, it will display it, and you will not need to refresh the page(f5).

I know this is causing because that you call $_SESSION variable when you are loading index.php, and its not defined unless you didnt ran insert.php, but i want to find another method/way to do this.

Any ideas how to do this? examples? show me, please!!

A: 

It doesn't sound particularly doable to do what you want done. Pages loaded after other pages can't exactly go back and change the past.

If you're absolutely sure that the frame is a vital part of your approach, you'll have to use cross-frame Javascript to allow the two documents to communicate. However, it may very well be that your application flow simply needs modified to make this task unnecessary. Depending on Javascript when not necessary is unwise.

Matchu