[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Get value of select field on load

Posted on 2012-09-08
Medium Priority
Last Modified: 2012-09-08

I have a select field and I want it so that when people go back it loads the previous selection. By default the browser posts the select field but I want it to echo the value.

<select name="make">
<option value="Make 1">Make 1</option>
<option value="Make 2">Make 2</option>

If option 1 was selected and the form was submitted then when someone pushes the back button I want it to echo the value of the option 1.

Hope that makes sense.

Question by:movieprodw
LVL 31

Accepted Solution

GwynforWeb earned 2000 total points
ID: 38380043
2 options are

(1) Remember the selection using cookies

(2) Submit the form information using Ajax so that you don't move from the page after submission.

This is not a trivial problem.

Author Closing Comment

ID: 38380135
Used sessions, thanks

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question