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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:20:26+00:00 2026-06-09T16:20:26+00:00

What options are available to send an error message back to the form page?

  • 0

What options are available to send an error message back to the form page?

I have a form on login.php it submits to process.php. process.php handles the db connection, validation etc. If there is an error, I want to pass that back to index.php.

ie:

    } else {
    session_destroy();
    header("Location: /login");
    $error = "Sorry, that user name or password is incorrect. Please try again.";
}

Since these are two different files, what are the best options available to set and retrieve the errors? $_POST, $_GET, $_SESSION?

  • 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-09T16:20:27+00:00Added an answer on June 9, 2026 at 4:20 pm

    For your specific case, and with the code given, $_SESSION is your best bet. I.e:

    $_SESSION['login_error_msg'] = "Sorry, that user name or password is incorrect. Please try again.";
    

    Then back in index.php you’d have to check that session variable somehow, e.g:

    if( ! empty($_SESSION['login_error_msg']))
    {
        //display the message however you want
        unset($_SESSION['login_error_msg'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What options are available for receiving instant alerts from web applications? I have a
Is there any code or custom options available to achieve the following : 1>
I'm looking for the cheapest options available for offering dynamically-generated digital content (a la
I've been researching nosql options available for .NET lately and MongoDB is emerging as
Are there any good technical comparisons available between the various game development options available.
I'm new to WCF and am overwhelmed by the options available for securing my
I understand that 2 options are available: Non-persistent Persistent But what does this actually
I'm reading the JSlint Options Documentation to understand each of the available options, and
I started using srbac in Yii. The options that are available: create a role,
My app has an options menu that is available in almost all Activities, which

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.