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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:27:34+00:00 2026-05-13T07:27:34+00:00

here is the case: ive got 2 lists on my website. country and region.

  • 0

here is the case:

ive got 2 lists on my website. country and region. when the user first enter the options are ALL and ALL. then he picks a country and a region. and i use jquery bbq to hash the url with different variables for remembering the unique ajax rendered pages. for example:

webpage#country=1&region=3
webpage#country=2&region=3

now i want the user to be able to send this url to another person and the browser will display the same html select lists.

so i came up with a solution:

first i grab the hash with jquery and turn them into cookies.
then i’ve got the following html code:

<select>
<?php
    while($row = mysqli_fetch_assoc($countries))
    {
                if($row['id'] == $_COOKIE['country'])
                {
                    echo "<option value='" . $row['id'] . "' selected>" . $row['name'] . "</option>";
                }
                else
                {
                    echo "<option value='" . $row['id'] . "'>" . $row['name'] . "</option>";
                }

    }
?>
</select>

this will show the option that the user had picked from the list. and the same things goes for the region select list.

but the problem is that it doesnt work in firefox. and in safari its too slow to be shown. the cookies are created after the html is shown. so i have to refresh the page a second time.

it just seems like its not a very good solution. and i dont want the html to render all the options and then afterwards change to the picked option with jquery. then the user sees the lists suddenly change and its ugly.

what are my options here? i think this issue has crossed a lot of ajax programmers mind.

(the site got more than 2 lists so i really want this to work)

  • 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-13T07:27:35+00:00Added an answer on May 13, 2026 at 7:27 am

    I don’t think cookies are moving you in the right direction. Cookies are for remembering something AFTER the first visit. Not before.

    No matter what, if you code this on the client side using javascript or anything else, some one will have a connection/browser slow enough that they will see the options load one way and then get switched. It sounds more like you want the server to dynamically generate the options list. Make it so the generated links are

    webpage?country=1&region=3
    webpage?country=2&region=3
    

    Then the server knows what was pre-selected and can generate the initial version with the right values pre-selected. But if the user comes in without passing in values for country/region, then just generate the page as you normally would.

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

Sidebar

Related Questions

I'm just going to throw all my code in here in case there's something
Here is the case. User should be able to open MS Word document which
Here is the case of my Netbeans debugging question: I got a for loop
Here's the use case: A user clicks on a link that opens a window
I can't figure out what's happening here. I've got a few lists set up,
I've seen similar solutions here but they are too specific. My case requires a
For example (in my case) here's some code, <?php woo_post_inside_before(); if ( $woo_options['woo_post_content'] !=
here the sample case.. i want to display banner randomly by percentage based on
I know it might look like a silly question but here is my case
I created report using reporting, but i am dizzy for case below here are

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.