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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:00:20+00:00 2026-06-07T06:00:20+00:00

I am working with php sessions and user accounts. When they click on the

  • 0

I am working with php sessions and user accounts. When they click on the Log Out link on a page it generates the code in logout.php which is…

<? 
session_start();
session_destroy();
Header( “Location: http://www.espn.com” );
?>

The page destroys the session and for some reason it just goes back to the index.php page. I want to have it so that when the user is log out they are redirected to the page THEY WERE JUST ON logged out. I think I need to just change the code in my logout.php but I don’t know what to do. I tried testing it by taking the user to espn.com but this didn’t even work. Can someone help me set it up so that the user is sent to the page they were just on.
Live Long and Prosper.

  • 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-07T06:00:21+00:00Added an answer on June 7, 2026 at 6:00 am
    Header( “Location: http://www.espn.com” );
    

    Should be

    header("Location: http://www.espn.com"); //<--NOTE: You are using wrong quotes!
    

    PS: Although php functions are case insensitive, but you’d better use the low case head same with manual.

    Update:
    If you want to redirect to the previous page, you could do:

    if (!empty($_SERVER['HTTP_REFERER'])) {
        header("Location: ".$_SERVER['HTTP_REFERER']);
    } else {
        header("Location: http://www.espn.com");
    }
    exit;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A have a problem with PHP application, that I'm working on. Main page which
I'm working on a PHP login/register system, and the login sessions are done using...
Working with PHP Xpath trying to quickly pull certain links within a html page.
I am working with php and want to have a page that has a
I recently upgraded to CodeIgniter 2.1. The below model code (machforms_model.php) was properly working
Question is easy and basic. I've been working with PHP sessions for years and
For logging out a user from my website, I am redirecting the page to
I want to get user input in one page, store that in a php
header(Location: … ); does not seem to be working: <?php session_start(); if (isset($_SESSION['user'])){ ?>
creating a basic log in page - it was working but then we changed

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.