HTML: Forms (Part 1)
Forms offer a popular way for the creator of a page to communicate with someone viewing the page. To fully exploit the potential of forms, it is necessary to use a server-based technology like the Common Gateway Interface (CGI) or Active Server Pages (ASP). Here we are learning the basics of setting up different kinds of forms using HTML.
Each form begins with <FORM> and ends with </FORM>.
The <INPUT> tag is the workhorse tag within forms. The <INPUT> tag takes these attributes:
|TYPE =||defines the <INPUT> element. TYPE can be TEXT, PASSWORD, CHECKBOX, HIDDEN, FILE, RADIO, BUTTON, SUBMIT, RESET or IMAGE.|
|NAME =||names the element|
|VALUE =||gives default content of element|
|CHECKED||determines whether the element is initially checked (CHECKBOX and RADIO elements)|
|SIZE||number of characters in TEXT box|
|MAXLENGTH||number of characters accepted|
Let's create a TEXT box and ask the viewer for his name. Here is (the key part of) the code to do this:
<p><b>What is your name?</b>
<input type=text name="yourName" value="" size=30><br>
The name of the TEXT box is "yourName," value is "" so the box will show up empty, and size=30 specifies that the box is 30 spaces wide.