back

Forms


To create a form, you use the <form> tag. The opening tag of the form element usually includes two attributes: method and action. The method attribute can be either get or post, which determines how your form data is sent to the script to process it. The action attribute is a pointer to the script that processes the form on the server side. If you belong to Geocities, you can use the following form.

<form method=post action="/cgi-bin/homestead/mail.pl?member_name">
.....
</form>


Submit and Reset Buttons
<input type="submit" value="I'm odne">
<input type="reset" value="Start over">


Text Input Field
To create a text-entry field, you use type="text" in the <input> tag. You can also include the attribute size tag. size indicates the length of the text-entry field, in characters; the default is 20 characters.

Enter Your Name: <input type="text" name="myname" size=30>
Enter your Email: <input type="text" name="email" size=20>

Enter Your Name:
Enter Your Email:


Radio Buttons
Radio buttons indicate a list of items, of which only one can be chosen. Radio buttons use radio for their type attribute.

<input type="radio" name="color" value="white">White
<input type="radio" name="color" value="red">Red
<input type="radio" name="color" value="blue">Blue

White Red Blue


Checkboxes
Checkboxes make it possible to choose multiple items in a list. Checkboxes use checkbox as their type.

<input type="checkbox" name="color" value="white">White
<input type="checkbox" name="color" value=""red">Red
<input type="checkbox" name="color" value="blue">Blue

White Red Blue


Text Areas
Text fields enable your reader to type text into a single-line fields. For multiple-line fields, use the <textarea> element. <textarea> includes three attributes.
name the name to be sent to the CGI script when the form is submitted.
rows The height of the text area element, in rows of text
cols The width of text area element in columns.
<textarea name="comment" rows="5" cols="30">
</textarea>


Selections
Selections are indicated by <select> tag, and individual options within the selection are indicated by <option> tag.

Select your favorite color:
<select name="color">
<option>White
<option>Red
<option>Blue
<option>Green
</select>

Select your favorite color:



Back to HTML tutor homepage | Back | Email me