form
element which acts as a container for all the other special elements that are used to render various form components. The form element has a start tag <form>
and an end tag </form>
and has two important attributes, action
and method
, which are described below:
action
~ The value of the action
attribute contains the URL to the script that will process the form (we'll get to that later...)method
~ The value of the method
attribute is either GET or POST. You will use one or the other depending on the requirements of the script processing the form. The method most commonly used is POST.<form action="URL to form script" method="POST">
</form>
<form>...</form>
tags may also contain most other HTML elements but, with the exception of <br>
tags, we'll leave them out for now to keep this tutorial simple. input
and textarea
. These are described below:
input
~ The input
element will create a single-line text box when the type="text"
attribute value pair is used. Only the start tag <input>
is used. The end tag is omitted. You will also require a name="control_name"
attribute-value pair where control_name
equals the control name (whatever you want) that you assign to this text box. This control name will be used by the script that processes this form to retrieve the data entered into this text box. Each input text box must have a different control name.Your name:<br><input type="text" name="realname"><br><br>
Your email:<br><input type="text" name="email">
textarea
~ The textarea
element creates a multi-line text box. It requires both a start tag <textarea>
and an end tag </textarea>
and the rows
and cols
attributes are used in the start tag to define its display size. These attributes are described below:rows="number_of_lines"
— This attribute-value pair specifies the height according to the number of text lines you wish the textarea
box to display.cols="width_in_characters"
— This attribute-value pair specifies the width according to the number of character widths you wish textarea
box to display.name="control_name"
attribute-value pair where control_name
equals the control name (whatever you want) that you assign to this text box. Hence if we insert the following code inside our form element:Your comments:<br>
<textarea name="comments" rows="15" cols="50">
</textarea>
textarea
box is 15 text lines high and 50 character widths wide.
input
element but this time we'll insert the type="submit"
attribute-value pair. To customize the text that is displayed on the submit button, you can use the value="your text"
attribute-value pair where your text
can be anything you want. To keep it simple (and polite) we'll just use the word "Submit". Hence if we insert the following code inside our form element :<input type="submit" value="Submit">
<body>...</body>
tags and then presto...contact.htm
".
Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates
See also:
If you need a .COM web address, you can get one quick and easy at...
INTRO | TOP | NEXT ~> |