HTML and CSS Reference
In-Depth Information
Which language your Web form will interact with depends on your Web server. You
can check with your ISP or system administrator to find out what programs are available,
and what rights and privileges you have in accessing them.
Alice is already working with a programmer on designing the program that will inter-
pret the survey results. You will not have access to that program, so Alice just wants you
to work with the Web form portion of this process. Other users will test your Web form
to verify that the information is being collected and processed correctly.
Creating a Web Form
Now that you're familiar with the way form data is stored and analyzed, you can begin to
work on the survey form. A Web form is inserted into a page using the form element
<form attributes >
content
</form>
where attributes is the attributes that name the form and control how it is processed,
and content is the content of the form. Forms typically contain many of the control ele-
ments that were listed earlier, but also can contain page elements such as tables, para-
graphs, inline images, and headings. A form element can be placed anywhere within the
body of a Web page, and a single page can contain multiple form elements.
Form attributes tell browsers the location of the server-based program to be with on
the form's data, how that data is to be transferred to the script, and other processing
information. However, these attributes are not needed when designing the form, and it's
actually useful to omit them at first. This prevents you from accidentally running the pro-
gram on an unfinished form, causing the Web server to process incomplete information.
After you've finalized the form's appearance, you can add the attributes required by the
server program. You'll have a chance to do this in the last session of this tutorial.
Two attributes identify the form: the id attribute and the name attribute. Naming a
form is useful for pages that contain multiple forms so you can differentiate one form
from another, and it is required for some server-based programs that need to reference a
particular form by name. The id attribute is used to uniquely identify the form element
among the different page elements. The syntax of both of these attributes is
<form name=” name ” id=” id ”> … </form>
where name is the name of the form and id is the id of the form. In many cases, you'll
use the same value for both the id and name attributes.
Inserting a Web Form
• To insert a Web form, add
<form attributes >
content
</form>
to the body of the Web page, where attributes is the attributes that identify the
form and control how it is processed, and content is the content of the form.
• To identify the form, add the attributes
id=” id ” name=” name
to the opening <form> tag, where id is the form id and name is the form name.
Search WWH ::




Custom Search