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 6470409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:06:29+00:00 2026-05-25T06:06:29+00:00

In my index.php file I call session_start() and set a couple of session variables.

  • 0

In my index.php file I call session_start() and set a couple of session variables. In a second PHP file I would like to access these session variables.

Thing is, this PHP file is purely a backend script and is POSTed to when a JavaScript function is triggered. When the POST call attempts to cause the script in the second PHP file to be executed the error log is reporting that:

_SESSION is an undefined variable.

I’ve tried calling start_session() and session_regenerate_id() at the top of the second PHP file but the issue has persisted.

I’m assuming what is going on is that because it’s in a POST this PHP file is in its own session as I am still able to do this $_COOKIE[ini_get('session.name')].

The information that I am trying to pass to the second PHP file isn’t anything that needs to be secured but it would be nice to know in the future how to do this: call a PHP file via a POST and still have my session variables.

  • 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-25T06:06:30+00:00Added an answer on May 25, 2026 at 6:06 am

    There’s nothing special whatsoever about POST requests and sessions.
    You just need to call session_start at the top of every file request you want to use sessions in, that’s it.

    Try again with that in mind, it ought to work.

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

Sidebar

Related Questions

Within my index.php file I have an AJAX function that will call a function
I have a index.php file that will include several external files: content/templates/id1/template.php content/templates/id2/template.php content/templates/id3/template.php
I'm trying to develop a Facebook application, and I have uploaded my index.php file,
I'm developing web page which has main file index.php as follows: include('UserClass.php'); include('html/top.php'); $user
I'm trying to redirect URLs by using the .htaccess file: index.php?i=Dengue-NS1-ELISA-kit---Antigen&id=682&cat=0 to index.php?i=Dengue-NS1-ELISA-kit---Antigen&id=682&cat=17 Notice
on $(document).ready(function() in index.php, the below AJAX is executed, running the file getData.php: if
When I require any PHP file in my index page I see an error:
I have a PHP script (index.php) that includes an index.html file in a sub-directory
pls help me how to create a .htaccess file as index.php?regional=aaa domain.com/aaa/ list.php?regional=aaa&ctg=bbb&orderby=ccc&page=123 domain.com/list/aaa/bbb/ccc/123/
Specifically in theme php files, such as say index.php. The very first thing in

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.