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

  • Home
  • SEARCH
  • 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 5934717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:09:10+00:00 2026-05-22T15:09:10+00:00

I have a comments form on my site. After the user submits the form,

  • 0

I have a comments form on my site. After the user submits the form, s/he will be redirected to a “thank you” page. I would prefer that the thank you page only be accessible if one has successfully submitted the form. If the user tries to access the thank you page without first submitting the form, I would like the user to be redirected to the home page. Any suggestions on the best way to do this?

UPDATE: The problem I am having with the solution below is that the user is redirected to the home page even if that user correctly submits the form.

Form page PHP:

<?php
if (!isset($_SESSION)) {
session_start();

$_SESSION['sendMessage'] = true;    

}

Thank you Page PHP:

<?php
if (!isset($_SESSION['sendMessage'])) {
header('Location: http://www.example.com/index.php');
      exit;
}
?>
  • 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-22T15:09:10+00:00Added an answer on May 22, 2026 at 3:09 pm

    You posted the solution yourself: store a value in the session.

    [edit]

    Mario is right. You’ll need session_start() in the Thank You page too.

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

Sidebar

Related Questions

I have a site where each user's page shows comments and allows other user's
I'm working on a social networking system that will have comments coming from several
I have an ASP.NET site which I'd like to add page-level comments to without
Greetings, I have a form where employees enter comments in a multiline textbox with
I have some source files that have comments written in Japanese. When I open
Here's what I need to fetch: - posts that have comments - number of
I have a site that has few request options (for example add photo, add
I have a site that lists several upcoming events, and each event has a
The site I'm building uses the standard user management framework and the standard comments
I have a very simple contact form on my site, Im looking for users

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.