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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:21:57+00:00 2026-05-20T19:21:57+00:00

I have a site that uses a GET form to allow a user to

  • 0

I have a site that uses a GET form to allow a user to specify a zipcode, and then provide sorted results by distance based on that entry. If no zipcode is present, then it simply displays all results.

My code works great. The problem is when I change from Page 1 to Page 2 I lose my query string.

For other technical reasons, I cannot use the POST method. Specifically I need to be able to save this query state somehow and check the url of the requested page, and the reappend that query string if it’s empty.

Any thoughts on how to do this? The site uses a lot of jQuery, but I’m not sure if jQuery has a way to remember this string across multiple pages. The site uses PHP as well. I don’t mind storing the results in a PHP session variable and then reconstructing the URL somehow, but I was hoping it would be a bit more straightforward than that. Thanks for your thoughts

Blue

  • 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-20T19:21:57+00:00Added an answer on May 20, 2026 at 7:21 pm

    I think the best option for this kind of persisting data is to use a session. Your code checks for two things, a GET value and a session value. We’ll assume if both are present, you take the GET value. This allows the user to submit a new one and override the old one.

    session_start();
    $zip = '';
    if($_GET['zip'])
    {
        //validate zip as needed
        $zip = $_GET['zip'];
        $_SESSION['zip'] = $zip;
    }
    elseif($_SESSION['zip'])
    {
        $zip = $_SESSION['zip'];
    }
    else
    {
        //handle default case
    }
    

    Then anytime your PHP code needs to reference the zip code for queries, etc, use the value in $zip. This way you don’t rely on the page itself to deal with the zip values – you store it serverside and use it any time you need it.

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

Sidebar

Related Questions

I have a site that uses a couple DropDownLists that are databound. I was
I have a web site that I administer that uses Apache 2.0 on the
We have an ASP.NET application running at a customer site that uses ActiveDirectory for
I have a site I made really fast that uses floats to display different
I have a web site in asp.net that uses a master page. In this
I have a simple PowerShell script that uses WMI to create a web site
On my site, I have a form that users fill out to become a
I have a project that uses a third party library in the form of
I currently have a site that uses the JQuery cycle plugin. The site uses
I have pages within a site containing a control that uses a query string

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.