HTML and CSS Reference
More things that can go in a form
Here's a whole new input element we haven't talked about. If
you need to send an entire file to a server script, you'll once
again use the <input> element, but this time set its type to “file”.
When you do that, the <input> element creates a control that
allows you to select a file and—when the form is submitted—the
contents of the file are sent with the rest of your form data to the
server. Remember, your server script will need to be expecting a
file upload, and also note that you must use the POST method to
use this element.
To create a file input element, just s et the
type of the <input> element to “file ”.
<input type="file" name="doc">
This isn't an element, but rather a new way to use an element
you already know. If you add the Boolean attribute multiple to
your <select> element, you turn your single-choice menu into
a multiple-choice menu. Instead of a pop-down menu, you'll get
a multiple-choice menu that shows all the options on the screen
(with a scroll bar if there are a lot of them); you can choose more
than one by holding down the Ctrl (Windows) or Command
(Mac) key as you select.
Just a dd the attribute
multip le to turn a single
selecti on menu into a multiple
selecti on menu.
<select name="characters" multiple>
<option value="Buckaroo">Buckaroo Banzai</option>
<option value="Tommy">Perfect Tommy</option>
<option value="Penny Priddy">Penny</option>
<option value="New Jersey">Jersey</option>
<option value="John Parker">John</option>