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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:05:17+00:00 2026-05-27T21:05:17+00:00

I guess my question is in understanding the $_POST handling. So I have two

  • 0

I guess my question is in understanding the $_POST handling.

So I have two pages that handle 2 forms. Page 1 asks for some information that will be used in page 2. When submitted the form action uses the same page then redirects to next page upon validation, but only handles the data when $_GET variable ?usersubmit=1.

<form action="<?=$_SERVER['PHP_SELF']?>?usersubmit=1" method="post" name="form1">
<input type="text" name="field1">
</form>

So say I have page called form1.php. Upon submit its sent to form1.php?usersubmit=1. The page now assigns the posted data to session variables and then redirects to form2.php via header(‘location:form2.php’).

<? 
if($_GET['usersubmit']){
    if($_POST['field1']){
      #if valid then assign session variable and redirect to next form
      $_SESSION['field1'] = $_POST['field1'];
      header("location:form2.php");
    }else{
      #if invalid send error message 
      $error = true;
    }
}
?>

My problem is in when users hit the ‘back’ button on their browser to edit data from a previous form. The browser doesnt re-post this data it just shows them a blank form. I’d prefer not to use $_SESSION data to fill out the forms because I suspect the re-post method may be a quicker and less problematic fix.

I also tried a javascript redirect instead of a header but browsers are smart enough to not send you back to a page that wants to redirect you so it doesnt work.

any help in understanding this would be greatly appreciated.
thanks.

  • 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-27T21:05:18+00:00Added an answer on May 27, 2026 at 9:05 pm

    The only way to handle it is via a session… HTML5 allows for storing of that kind of data but to be honest I wouldnt even look into it as a possibility just yet, altough it does work.

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

Sidebar

Related Questions

I have a question which is in some way, I guess, completely trivial: what's
This is more of a general design question I guess... I have an Ajax
I am working with linux kernel 2.6.38 and have a question about two fields
Lets say that I have a table with some key, accounts, and hits. Which
I have a variation of the benefits-of-async/await-on-ASP.NET from this question . My understanding is
I guess my question derives partially from this question: std::ifstream buffer caching. I have
Some background: I have an database that I want to use linq-to-sql to update
I currently have some code that looks like: -(UIView)someMethod { CGRectMake(0,0,100,100); UILabel *label =
I guess the question title sums it up. Is there a time when it
Okay guess this question looks a lot like: What is the best way to

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.