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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:58:54+00:00 2026-05-21T22:58:54+00:00

I have a multipage form, with back buttons, and I’m trying to have a

  • 0

I have a multipage form, with back buttons, and I’m trying to have a server-side way to maintain the form data if the user clicks back.

I have a back button like this:

<button id="backButton">Back</button>

And the button handler is as such:

$('#backButton').live('click',function() {
        window.history.back();
    });

After the first part of the form is submitted, I put all of the submitted data into $_SESSION variables. I can even echo out those variables on the second part of the form, but when I click the back button to go to the first part of the form, the session variables don’t carry over.

I am starting the session correctly and I use session variables for various other parts of the site, and they work flawlessly.

How can I carry variables back when a back button is pressed?

  • 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-21T22:58:54+00:00Added an answer on May 21, 2026 at 10:58 pm

    Sennheiser,
    I can’t get a handle on your exact situation, but I can get your problem. Here are my thoughts:

    1. When the user hits ‘back’, they usually load the page from the browser cache. Ergo, the browser is not asking PHP to re-parse the page with the session variables. Try hitting shift or Control F5 to re-request the page from the server.
    2. #1 being successful or not is irrelevant, since no user is going to refresh the page thinking their results will return. You have to rely upon the browser OR JavaScript.
    3. A brief review, looking this up, makes me think the following solutions are your best bet:

    You can either..

    • Use JavaScript to retrieve the form data and save the contents to a cookie, which will be loaded (Safely!! Look out for XSS..) whenever the form is loaded. You seem to use jQuery, that’ll help! I’m unsure of the safety, but read up on $.('#formID').serialize().

    • Rely upon the browser’s native form-saving components. While doing a review of stack overflow, I found a similar question that had an answer that can help you. In summation, if your forms are automatically generated by JS or the page is non-cacheable (likely https, or your server says no-cache), you cannot rely upon the browser to save the form.

    Let me know if my answers helped.

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

Sidebar

Related Questions

I have a multi-page form, and I'm trying to implement Back buttons, so that
I have a cookie I am setting when a user clicks a button on
I have this button with which I want to send data back to the
I have a multipart form that takes basic user information at the beginning with
i have a form that has a multiple select drop down. a user can
I have a form on an HTML page with multiple submit buttons that perform
I have a main form that has multiple buttons on it that will allow
I have a file upload form that is being posted back to a servlet
This is what I have: <form name=myts method=post action=ts.php enctype=multipart/form-data onsubmit=return upuInit(this)> . .
Scenario: I have multiple text boxes in which a user will enter data into

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.