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

The Archive Base Latest Questions

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

I am developing a php script which contains an html form. If not all

  • 0

I am developing a php script which contains an html form.

If not all fields are filled in the correct way the script will signal an error and redirect back to the same page with the header function setting an error variable to yes with the get method:

header("Location: registration_page.php?error_empty=yes");

my script has an error handling part in which it highlights the fields containing a mistake, but I would like to keep the value of the fields correctly filled.

I am implementing this feature as I found in this other question:

How can I keep a value in a text input after a submit occurs?

but the problem is that when the page reopens the forms will not contain the old values.

My question is: does anybody know if the header function unsets global variables in the $_REQUEST array?

And do you know what kind of solution could I adopt?Maybe sessions?

Thanks in advance,

Matteo!

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

    $_COOKIES will stay set, but $_POST & $_GET will be destroyed, as the client is moving to a new page. If they need to be retained, they must first be stored into $_SESSION before calling the redirect.

    session_start();
    $_SESSION['last_post'] = $_POST;
    header("Location: http://example.com");
    exit();
    
    // On the redirected page, use the stored POST values and unset them in $_SESSION
    session_start();
    if (empty($_POST) && isset($_SESSION['last_post'])) {
      $post = $_SESSION['last_post'];
      unset($_SESSION['last_post']);
    }
    else $post = $_POST;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are creating a php script project; which we will be selling to customers.
I am developing a script in my localhst using PHP and mysql and I
I'm developing a greasemonkey plugin, which is supposed to send a form in background
I am developing a PHP script that has to make some calls to a
I am developing a PHP script for uploading .PDF documents as medium BLOBs into
I am developing a PHP/MySQL application which entails processing of CSV files but the
I'm developing a PHP application which uses Twig (but that's unimportant) as the view
I am developing a WebApp in PHP. The user will be able to click
I'm developing a php script involving parsing data from xls files. I'm using library
I'm currently developing a website that will make use of PHP scripts and I'd

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.