WordPress.org

Ready to get started?Download WordPress

Forums

$_SESSION variables changing in Firefox - WEIRD (2 posts)

  1. eschmidt99
    Member
    Posted 2 years ago #

    Hello,

    I'm using session variables on one small part of my site but am having some weird problems.

    The example:
    [code]

    <?php
    session_start();
    ...
    $_SESSION['research'] = rand(1,100);
    echo $_SESSION['research'];
    ?>
    <div class="item-entry research">
    <p class="large" style="text-align:center; margin: 0; padding: 0; margin-bottom: 7px;"><a style="color: #000;" href="/livingbook/research.php" target="_new" onclick="window.open('/livingbook/research.php', 'new', 'width=650, height=500'); return false;">New Research Information</a></p>
    </div>

    [/code]

    My research.php code:
    [code]

    <?php
    session_start();
    ?>
    <div style="max-width: 960px; margin: 0 auto;">
    <?php
    echo $_SESSION['research'];
    ?>
    </div>

    [/code]

    Unfortunately I can't provide a link to the site as it's already running (this session variable addition is an update) and the site contains research data but I will try to explain what's happening.

    What happens is in Internet Explorer a random number is displayed and on the research.php page the same random number is echo'd out. However, on Firefox, a random number is displayed and on the research.php page a DIFFERENT number is displayed.

    Now when I change the session variable to a take a custom meta field from a post it will work fine in IE but in Firefox it displays properly on the first page but on the research.php page it will display the custom meta field of the post BEFORE the one I was viewing unless the previous post's custom meta field is empty, then it displays properly.

    I can clear my cache, cookies and all and load a post page directly and it will still load the previous post's custom meta field when using Firefox.

    I hope that makes sense, I'm pulling my hair out with this one and just can't figure out why the session variable is being altered in FF but not in IE.

    Thanks for any help!

  2. eschmidt99
    Member
    Posted 2 years ago #

    Any ideas or is the question poorly worded and nonsensical?

Topic Closed

This topic has been closed to new replies.

About this Topic