Get value of select field on load


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.

Who is Participating?
GwynforWebConnect With a Mentor Commented:
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.
movieprodwAuthor Commented:
Used sessions, thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.