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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:29:34+00:00 2026-06-02T20:29:34+00:00

I have a dynamic website with pages drawn using PHP. Using the $_GET variable

  • 0

I have a dynamic website with pages drawn using PHP.

Using the $_GET variable I am getting commands from the user, executing PHP based on the $_GET command, and drawing a page.

However, when the user presses the back button I want them to see the page that was dynamically drawn for them before, instead of re-executing code.

I’ve seen this done, but can’t figure out how to do it.

For instance assume the following code:

if ($_GET['cmd'] == "time") {
   echo "The current Unix timestamp is: " . time;
}

Clicking the url: somepage.php?cmd=time executes the code properly but when using the back button, re-executes the code. Is there a way using cache, or something else I don’t know about, that will allow the user to see the time as it was when the page was drawn, instead of re-executing?

=========================================================================================
To try and be a little more specific, the pages and code that I am talking about perform multiple functions and alter MySQL data based on the commands given then draw the page.

I want to know if there is a way, when using the back button, to not re-execute but to just show the page that was drawn dynamically the first time.

  • 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-02T20:29:35+00:00Added an answer on June 2, 2026 at 8:29 pm

    I’ not sure if this is what you are looking for, but it may be of help. Rather than using php get, you might use ajax and then implement this: http://www.nerdswithlives.com/2010/03/yui-ajax-browser-history-back-button.html

    You could also have some type of variable stored every time a specific get command is executed, then check for that variable to determine which content to redraw on page load.

    EDIT

    From thinking more about your problem, I believe the answer lies with using PHP Sessions, and storing data on the clients machine. When a user clicks “back” he/she IS going to the cached page… so caching is not your answer. You need it re-drawn a specific way, but because you are using GET, the browser does NOT cache this… at least with back button functionality anyway. Your answer is to start a session on each page this dynamic content exists, store a variable like $_SESSION['sessionVar'] = 1; or whatever. Then dynamically change the variable depending on what was drawn on that page. Then, when the user clicks “back” you can check for whatever that variable is and get the data again. Get out of the mindset of using cache for this – you need to RE-DRAW whatever data the user saw previously. Sessions would be useful in this case.

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

Sidebar

Related Questions

Currently, I have a semi-dynamic system for my website's pages. head.php has all the
I have a dynamic website which generates the product pages dynamically from imported data.
I am making a simple Dynamic Website using PHP, where i allow the user
I have a nginx + uwsgi website (using Flask for dynamic python pages). I
I have a dynamic website, and use the share button on various pages of
I have a website with the following architecture: End user ---> Server A (PHP)
I'm currently creating a jquery based dynamic website. I have a top div and
To make a long story short, I have dynamic pages on a website that
I'm developing a dynamic website using jQuery and I have found several jQuery plugins
I have dynamic array filled with bytes, which are read from .raw file with

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.