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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:18:08+00:00 2026-05-13T11:18:08+00:00

On my website, user’s are allowed to filter games by Genre. When a user

  • 0

On my website, user’s are allowed to filter games by Genre. When a user chooses a genre from the select box and hits submit, the page uses GET to see what the filter was. Now the filter works fine, the problem is that the select box’s selection goes to the default one (Which says “All”.)

I want it so that after a user submits their filter request, the select box will keep that selection after the page reloads.

There’s only one way I could think of to do this but it would require adding in PHP into every option there is. Are there any simpler ways to go about doing this with PHP or jQuery?

  • 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-13T11:18:09+00:00Added an answer on May 13, 2026 at 11:18 am

    Assuming you’re doing a full form submit the selected option is only going to be available to the server-side code, once it gets back to the client to use jQuery you won’t have that (unless you try to use cookies before the form submit, but bleh).

    I’d use PHP in the option tag and echo selected="selected" if the option matches up with the selected option.

    If you want to avoid a lot of duplicated code why not do something like this:

    <select name="test">
    <?php
    $options = array(1 => 'Option 1', 2 => 'Option 2', 3 => 'Option 3');
    foreach ($options as $key => $value) { 
       echo '<option value="' . $key . '"' . ($key == $_GET["test"] ? ' selected="selected"' : '') . '>' . $value . '</option>';
    } ?>
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i am developing a website where user will select the timezone from a
I have this FQL query select uid, name, website from user where website !=
I'm building a website with user generated content. On the home page I want
Here's the situation. Multi-million user website. Each user's page has a message section. Anyone
On one page of my website the user has the ability to choose and
I'm developing website where user submit credentials using ajax,php and using POST method and
I have a scenario where the website user have a filter-bar, to set what
I have a website where user can select themes, customize background,text and many more.
I am developing a website where user logs in and access different reports from
I have implemented endless scrolling to my website user account area and before more

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.