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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:04:21+00:00 2026-06-03T07:04:21+00:00

I am having an issue with the session variables. I am having a simple

  • 0

I am having an issue with the session variables.

I am having a simple signup php page that uses ajax calls to verify username and email address if they already exist. It also has an ajax image uploader that gives a preview of the selected image.

Now this is how I am setting the session variable :-

session_start();
session_unset();
$_SESSION = array();

if (ini_get("session.use_cookies")) {
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000,
        $params["path"], $params["domain"],
        $params["secure"], $params["httponly"]
    );
}

session_destroy();
session_start();

$_SESSION['avurl'] = $filename;

$filename is valid as it is echoed in the above code just after this snippet.

In the page where I need to use this session variable I have this :-

session_start();

$av_url = $_SESSION['avurl'];

Now the weird thing is that whenever this runs the first time the session variable doesn’t have any value. But the second time it works.

How I came to check this is that I created a test.php which just echos $_SESSION[‘avurl’] and the first time it never shows anything but the second time it does.

What I figured out from this is that once it echoes this session variable it starts working to store the value.

And all that code that I am using to set that variable is edited from just :-

session_start();

$_SESSION['avurl'] = $filename;

to that as this also didn’t work and I thought that this could be a problem with already existing sessions.

Thankyou
Hope this is enough information for solving my problem !!

  • 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-06-03T07:04:23+00:00Added an answer on June 3, 2026 at 7:04 am
    session_start();
    session_unset();
    

    This code delete Your session… Why You doing this?

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

Sidebar

Related Questions

I am having an issue with transfering PHP session variables after a payment is
I'm having an issue with ASP.NET's session variables and a web service proxy object.
I having issue that content assistant / intellisense is working in methods such as
i am having issue with loading my selector via a jquery ajax load call
Having an issue here that I have tried everything I can think of but
having same issue, i am totally new in php. i install XAMPP then download
I have an application that uses coldfusion's session management (instead of the J2EE) session
I'm having a weird issue that I can't track down... For context, I have
I'm having an issue accessing raw request information from PHP when accessing a script
I'm having a bit of an issue by using Conditional Statements in PHP separated

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.