HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 17. FORMS AND INPUTS 173


Static things, be they webpages, images, or embedded media, are the same
every time and for every customer. We store the pages as html files on the
server.


Dynamic things, typically webpages, are made to order when they are re-
quested. They are typically different every time and for every customer.
Examples include web-based email, Facebook, and any website where you
log in.


This customization depends on that two-way communication. Two-way
communication usesCGIprograms. We talk briefly about CGI programs
in section 17.7.2 (page 182) below.


Two-way communication is the subject of this chapter.


How do you communicate with the server that is the source of the web page
you receive?


The simple answer is “forms.”


We use forms to let the user provide information to the server. The browser
lets the user fill out the form. Then the browser sends the data from the form
to the server. The server responds by sending a new, customized webpage,
back to the browser.


17.1 The form Tag


Forms are used to submit information from the user, by way of the browser,
to a server somewhere.


is the tag to start a form.
is the tag to end a form.

Exam Question 306(p.354):For each

tag in valid HTML5, is a
separate closing tag required, optional, or forbidden?
Required Answer:optional


Without the form tag, you can still make something that looks like a form,
but it will not communicate with a server.


The form has several commonly used attributes.


method=can bepostorget.


action=specifies the URL of a program that will process the inputs if the

Free download pdf