/    Sign up×
Community /Pin to ProfileBookmark

Hi everyone,

I need some help to do this:
I have the follwing list box on my page.

<select name=”countries[]”>
<option value=””>Select a country</option>
<option value=”Afghanistan “>Afghanistan </option>
<option value=”Albania “>Albania</option>
<option value=”Algeria “>Algeria </option>
<option value=”Andorra”>Andorra </option>
..
..
..
<option value=”Zimbabwe “>Zimbabwe </option>
</select>

When the user selects a country and clicks on a button “Search”, the list goes back and shows “Select a country”, what I want is keeping the selected coutry until the user chooses another one or refresh the page.

Thanks in advance.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@ExuroJun 16.2004 — You'll probably need to use cookies:

http://www.htmlgoodies.com/beyond/cookie.html

However, if your server has ASP.Net capabilities, you could set the select box as an ASP.Net element and it would preserve its state on its own.
×

Success!

Help @wafasn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...