Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Using Other Form Controls 347

12


Because this form contains a file upload field, we have to use the post method and the
multipart/form-data enctype in the

tag. The action attribute points to a CGI
script that lives on my server. Next, we start adding form inputs. Here’s the name input:






All the inputs will follow this basic pattern. The input and its label are nested within
a

. In this case, the label has the classes field and required. The only attribute
included in the input tag is the field name because the default values for the rest of the
attributes are fine. Next is the gender field, which uses two radio buttons:







As you can see, the radio button group includes two controls (both with the same name,
establishing the group). Because we didn’t include line breaks between the two fields,
they appear side by side in the form. Here’s an instance in which I used the


The next field is a select list that enables the user to indicate which operating system he
runs on his computer :






This select list is a single-line, single-select field with four options. Instead of using
the display values as the values that will be sent back to the server, we opt to set them



Free download pdf