Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Jun 2007
    Location
    Scotts Valley, CA
    Posts
    49
    Member #
    15405
    Hi all,

    So here's the issue: I have a site I'm currently developing, that displays the bulk of its content within an iframe. To view the site, go to:
    http://www.sessions.info/distributor/New_Site
    I'm looking to have a lot of user-specific information that will come up within the iframes on the page depending on the selections from the left menus.

    In a previous incarnation of this site (which is embarrassingly pedestrian-looking), I used similiar customized content, and accessed it from the database using a session variable identifying the user. The previous site did not use iframes. I'm wondering if anyone has advice as to the best way to approach passing the session variables between the iframes and the parent, and among the pages displayed within the iframe.

    I've tried sticking <? session_start();?> at the top of each page, but that's really as far as I've gotten. The site, btw, is far from complete, although more elements should be coming online daily.

    Cheers,

    k.

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    I'm not sure what you're asking. Session variables should persist across the session, thus once they are set, any new pages that are accessed within that session (typically, before the user closes their browser) should have access to the same variables.

  4. #3
    Member
    Join Date
    Jun 2007
    Location
    Scotts Valley, CA
    Posts
    49
    Member #
    15405
    Hmmm... I guess I'm not completely clear on how the session variables are stored. My impression was that the session could be broken if the user navigated away from the site (the reason why I had <? session_start(); ?> at the top of each page).

    For this page, because all the new content gets displayed in the iframe, the session for the parent window is started before the user logs in. I'm wondering if there's a way to pass the variable to the parent window to use in subsequent queries to the database. The functions I had working on the previous site are no longer functioning here...

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Since usually session keys are stored in session cookies on the browser, navigating away from the page should have little to no effect. Moreover, once a variable has been set, it should be accessible by all subsequent page loads. However, the fact that you're session_starting on every page might be a problem... You may actually be starting a new session and invalidating the old one (I don't exactly recall how session_start works). According to the docs, however, that shouldn't be happening. So I'm not sure what's up.

  6. #5
    Member
    Join Date
    Jun 2007
    Location
    Scotts Valley, CA
    Posts
    49
    Member #
    15405
    Hi Shadowfiend,

    Thanks for the feedback... I checked it out and realized that I had forgotten to start the session on the critical page. I've now got it working. My understanding was that including session_start() at the top of each page was the way to pass the session variables so that they could be used on that page.

    In fact, my initial issue wasn't the problem at all. The problem was that where I was trying to hunt down the user information, I'd forgotten to start the session (the heel of my hand is bonking my forehead here). In any case, I hope the question wound up being helpful, at least as a cautionary tale of being meticulous in checking the code.

    Cheers,

    K.

  7. #6
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Awesome. Glad to hear you fixed it!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

access to main session in iframe php
,
hosting page in iframe access to session data
,
how to get same session in main page and iframe in php
,
html send variable to iframe parent
,
iframe how to reset all the previous variables
,
iframe pass variable to parent page
,

pass session variable to iframe

,
php passing variables between main page and iframe
,
session variable shared iframe
,
sessions across iframes php
Click on a term to search for related topics.
All times are GMT -6. The time now is 08:19 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com