Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3225430
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:20:18+00:00 2026-05-17T16:20:18+00:00

I have a class that sets various session variables. After I set the session

  • 0

I have a class that sets various session variables. After I set the session variable I do a var dump of SESSION and get an output of them all. all good so far. Then I navigate to another page.

session_start(); // i call this right after opening the php tag
var_dump($_SESSION); // i call this after setting the variables

and it’s empty this time?

Setting my sessions

while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC))
    {
           $_SESSION['atid'] = $row['autotaskid'];
           $_SESSION['bmsid'] = $row['bmsid'];
           $_SESSION['shavlikid'] = $row['shavlikid'];
           $_SESSION['cpid'] = $row['cpid'];
    }

Trying to use the variables on another page

$autotaskid = $_SESSION['atid'];
    $tsql = "SELECT COUNT(tblBackupArchive.StatusID) AS total, tblBackupArchive.StatusID ".
            "FROM tblBackupArchive INNER JOIN ".
            "tblBackup ON tblBackupArchive.BackupID = tblBackup.BackupID ".
            "GROUP BY tblBackupArchive.StatusID, tblBackup.ClientID ".
            "HAVING (tblBackup.ClientID = " . $autotaskid . ")";    

Results in

Undefined index: atid in C:\Program File...

I’ve made sure I’m issuing the start_session(); function before any other code is run on every page that uses them.

Another important point: the php page that calls the method setting the variables within an iframe. when i open the page in a new tab/window it sets the sessions correctly. It’s almost like the main window has session variables and then each iframe keeps it own seperate.

Any ideas?

Billy

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:20:19+00:00Added an answer on May 17, 2026 at 4:20 pm

    Any ideas?

    Yes. You have to learn to debug your code.
    As you can see, your question cannot be answered out of guesswork. So, it’s time for handwork.

    • First make sure you can see any error occurred. Just add an intentional one and see. If you see no errors you have to turn it on.
    • then make a testing script to see if your sessions do work

      <? 
      session_start(); 
      if (!isset($_SESSION['counter'])) $_SESSION['counter']=0;
      echo "Refreshed ".$_SESSION['counter']++." times.<br>
      <a href=".$_SERVER['PHP_SELF'].'?'.session_name().'='.session_id().">refresh</a>"; 
      ?>
      

    if it works, make it to use cookies

    <? 
    session_start(); 
    if (!isset($_SESSION['counter'])) $_SESSION['counter']=0;
    echo "Refreshed ".$_SESSION['counter']++." times.<br>
    <a href=".$_SERVER['PHP_SELF'].">refresh</a>"; 
    ?>
    

    if it works too, you have to check your code.
    Print out variables, reduce code, etc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a class that sets the current time when an object has
I'm defining a class that sets a Drawable attribute in an object. The problem
I have a class whose instances have attributes that are containers which themselves contain
So, I'm struggling a bit with my programming project. I have a object that
I've seen various MVC frameworks as well as standalone ORM frameworks for PHP, as
I have a solution where i pass a collection of items from a source
Given an enum similar to this: Friend Enum TestValue As Int32 tstNotSet = -1
Ok, so I'm a relative noob with Objective-C/iOS programming, so hopefully someone with more
Hopefully this isn't too stupid but I want to make sure I'm doing this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.