2. Forms
• When a set of information or data is to be
received, it is appreciated if the same
could be received into a form.
• A form can contain text boxes, check
boxes, radio buttons, etc.
• Form tag - <form> …..</form>
3. Attributes of form tag
Form tag uses two attributes
1. Method
• Used to set the method through which the
form’s data is sent to the server for
processing.
• There are two values under method attribute.
• They are ‘post’ and ‘get’.
2. Action
• A pointer to the script processing the form on
the server
4. <INPUT> tag
• Used to define the actual form element
from among the elements. It does not
contain a end tag.
Attributes of input tag
1. Type – identifies the element to be
included in the form.
2. Name – specifies the name of the
element to be included in the form.
5. Elements of input tag
1. Text – will accept the text of a defined size into
a text box.
2. Check – display a check box and in case of
multiple check boxes it allows selecting more
than one.
3. Radio – display a radio button and unlike check
box, it will allow selecting any one of the
options only.
4. Button – display a command button which can
be designed for two purposes, one for sending
the data and the other for clearing the elements
from such as “submit” and “clear” respectively.
6. 5. Option – allow the user to insert a set of
names into a list box. The tag being
<option> …….</option>, which in turn
appears within the <select> …..
</select> tag.
6. Text area – used to have a text box
ranging from a set of “rows” and “cols”
for a multi line text area.
7. Password – used to mask the characters
keyed into the text box with a character
usually asterisks (*)
7. Example for elements
HTML>
<HEAD>
<TITLE> form </TITLE>
</HEAD>
<body>
<form action = “form.html” method = “post”>
<h1>computers in education</h1>
<font face = “times new roman” size = “3”>
Name:<input type = “text” name = “Name” size = “20”>
sex: <input type = “Radio” name = “Sex” value = “male”> male
<input type = “Radio” name = “Sex” value = “female”> female
Courses opted for: <select name = “courses opted”>
<option> ms office </option>
<option> visual basic </option>
<option> java </option>
<input type = “submit” value = “submit”>
<input type = “reset” value = “clear”> </center>
</form>
</body>
</HTML>