Form Tutor - Lesson 8

The next type of input is a Pull Down List. With this type you use <select> instead of <input> and it has a closing tag. Let's make one.

 
<form>
<select>
</select>
</form>


Don't forget to give it a name.

 
<form>
<select name="best friend">
</select>
</form>


Next add a few options.

 
<form>
<select name="best friend">
<option>Ed
<option>Rick
<option>Tom
<option>Guido
</select>
</form>


And give each <option> a value.

 
<form>
<select name="best friend">
<option value="ed">Ed
<option value="rick">Rick
<option value="tom">Tom
<option value="guido">Guido
</select>
</form>

The default option is the one that is listed first.


We can specify a default other than the first option in the list.

 
<form>
<select name="best friend">
<option value="ed">Ed
<option value="rick">Rick
<option value="tom" selected>Tom
<option value="guido">Guido
</select>
</form>


As you can probably guess, a Pull Down List returns one name/value pair...

 
best friend=tom

<< BACK NEXT >>