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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:23:59+00:00 2026-06-03T15:23:59+00:00

I am currently building a multiple pages form using $_SESSION , everything has been

  • 0

I am currently building a multiple pages form using $_SESSION, everything has been working fine so far. Yet, even though I am able to retrieve all the data at the end of the 6 pages, it seems that it is not possible to go back in the form if the user made a mistake.

Let’s say he is at page 5 and he realizes that he needs to go back to page 3 to change something, he won’t be able to do so. Firefox gives this error message :

Document Expired
This document is no longer available.
The requested document is not available in Firefox’s cache.As a security precaution, Firefox does not automatically re-request sensitive documents.Click Try Again to re-request the document from the website.

This is what my forms look like, this one is Form-1.php :

<form action="Form-2.php" method="post">
        <fieldset>
                <legend>Information</legend>
                <p>
                    <label for="name">Name</label>
                    <input id="name" type="text" name="name" required/>
                </p>
                <p>
                    <label for="age">Age</label>
                    <input id="age" type="number" name="age" placeholder="Ex. 1988" required/>
                </p>
                <p>
                    <input id="sex-m" type="radio" name="sex" value="Male" required/>
                    <label for="sex-m">Male</label>
                    <input id="sex-f" type="radio" name="sex" value="Female" required/>
                    <label for="sex-f">Female</label>
                </p>
        </fieldset>
        <input type="submit" value="Next page"/>
</form>

I am using SESSION to retrieve data from the previous form, this one is from Form-2.php :

session_start();

$_SESSION['name'] = $_POST['name'];
$_SESSION['age'] = $_POST['age'];
$_SESSION['sex'] = $_POST['sex'];

And so on for the six pages.

It works fine, it retrieves all the values correctly, but it is not possible to go back when filling the form.

What am I doing wrong? How can I make sure the user will be able to go back if he makes a mistake?

Thanks for your help.

EDIT :

I ended up with the following code, solving half of my problem. Still from Form-2.php :

session_start();

if (isset($_SESSION['location']) && isset($_SESSION['job'])) {
        $location = $_SESSION['location'];
        $job = $_SESSION['job'];
} else {
        $_SESSION['name'] = $_POST['name'];
        $_SESSION['age'] = $_POST['age'];
        $_SESSION['sex'] = $_POST['sex'];

        $location = '';
        $job = '';
}

Then I simply display the values in the fields with :

If text : <?php echo $location; ?>

If radio : <?php if(isset($job) && $job == "Yes"){echo "checked=\"checked\" ";} ?>

It works quite well, the different forms – if the values have been set – are pre-populated just fine.

My problem is, as you can see, if I go back and change a value, it won’t be taken into consideration as I am ignoring POST if there is a corresponding value stored in SESSION.

I can’t figure out how to make this work properly… Any hint?

  • 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-03T15:24:01+00:00Added an answer on June 3, 2026 at 3:24 pm

    Not the best solution, but does the job: Do not use back buttons, provide your own forward, backwards, “step” buttons. Then populate the form with the data stored in e.g. the session.

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

Sidebar

Related Questions

I am currently building a questionnaire system which spans over multiple steps (pages). I
I am currently building a website with multiple pages and in order to beautify
I am currently building an Excel 2007 Add-in using VSTO (latest version + sp1)
I am currently building a web site and I just implemented SqlCacheDependency using LinqToSQL
I am writing a wizard form in rails; e.g. multiple input pages for one
I am building an multiple file upload form that user can use to upload
I am currently building an application where I have multiple ways to access the
I'm currently building a multiple-document interface application, but I'm having a problem when the
we are currently building our first large application with Silverlight 4 (using PRISM) and
I'm currently building an application using Sencha Touch. We have a certain Carousel on

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.