HTML: Form Tag




To contact us



HOME] Consulting Design Maintenance Project Testing Training Turnkey Java C++ SQL HTML JavaScript ]


© 2002 - 2013 All Rights Reserved Total Application Works

    Tell a friend about this site (copy and paste the following HTML page into a file (e.g., using Notepad).)
    <html>
    <head>
    <title>Example of a link </title>
    </head>
    <body>
    <a href="http://sumtotalz.com/TotalAppsWorks/HTML/forms.html">
    Form Tags </a>
    </table>
    </body>
    </html>




  • Introduction
  • Requirements for a Basic Form Template
  • HTML Form Tag and its Attributes
  • HTML Examples of how to use the Form Tag

    Introduction

    In this tutorial, we will explore how to create an HTML form. What is the purpose of a HTML Form? The HTML Form allows you to request information from users viewing your web page. Forms are the most popular way to make web pages interactive. The type of information that you can request from users, using the forms tags, are:

    • Choose from menus
    • Make choices from radio buttons
    • Click on checkboxes
    • Enter text information
    When you create a form on your HTML page, the content for the form is included between a <form> and a </form> tag. After which the entered information is submitted to a web server for processing.

    Requirements for a Basic Form Template

    What are the requirements for a Basic Form Template? In the following example, show:

    1. <Form> - the tag that starts the Form
    2. Method - the tag that indicates the method that will respond to this request
    3. Action - the tag that indicates the location where the above method is resides
    4. <Input...> - the tag that indicates the type of input field (see figure 3)
    5. <Select - is a container tag that allows the user to make a choice
    6. </Select - ends the select section
    7. <Textarea - allows the user to enter multiple lines of text
    8. </Textarea - ends the text area
    9. </Form> - the tag that ends the Form container
    For example, the basic form template might look like the example in the following table.

     
    <BODY>  
       ...
    
    <FORM METHOD="method that responds to the submitted request"
       ACTION="URL of the server where the above method resides">
    ...input data content... ...select data content... ...textarea data content... </FORM> ... ... </BODY>
    Figure 1: Basic Form


    When we consider using the <form> tag, we should note that we can place the <form> tag anywhere within the <body> and </body> tags of an HTML document, and all input tags, select tags, and textarea tags must be contained within FORM tags. In the following sections we will explore the FORM attributes with examples showing how to create a form.

    HTML Form Tag and its Attributes

    The following table shows the FORM tag and its attributes.

    Tag Attribute
         <FORM>     
    ACTION: URL of the server that will process the data/request found in this form.
    METHOD = GET | POST: this is the method that processes the data sent to the server for further processing.
    NAME: name of this form.
    ENCTYPE: Specifies the MIME (Internet mediatype). This indicates the format of the data submitted to the server.
    This is most often used with forms where there is a file-upload option.
    TARGET: determines where the results will be displayed - "_blank" | "_parent" | "_self" | "_top" | frame name
    onSubmit: method to run before the form is submitted
    onReset: method to run before the form is reset.
    Figure 2: Form tag and its attributes


    We will use the information from Figure 2 in building the forms in this tutorial. In the next section, will explore the INPUT tag.

    HTML Examples of how to use the Form Tag

    The following list contains additional examples on how to use the Form Tag.

    1. Introduction to the form tag
    2. Sum or Average four integers








  • HOME] Consulting Design Maintenance Project Testing Training Turnkey Java C++ SQL HTML JavaScript ]


    To contact us

    © 2002 - 2013 All Rights Reserved Total Application Works