Sign in to follow this  

[web] Setting SELECT default choice

Recommended Posts

If I have a script wih a SELECT-style dropdown menu and the user enters, let's say, an invalid e-mail address, and hits submit, I want to return back to the script with each field displaying what the user had entered previously. I can do this for text forms easily with value="<?php if isset(...), echo ...; ?>", but how do I do this with a SELECT/OPTION combo?

Share this post

Link to post
Share on other sites
Original post by Tesseract
Newer browsers will require you to set the default selected tag as follows:

<option selected="selected">stuff</option>

Not newer browsers, newer doctypes. Namely xhtml.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this