Page 11 - LoudOffice_Guide-to-HTML_Part-II_Advanced.PDF
P. 11

anything from manipulating data (say in an online calculator), to working with a database
               (to store a user’s profile), to emailing feedback to a webmaster.


               Below is an example of a simple feedback form that uses a couple of the elements we will
               talk about in a few moments.































               The <form> Element
               A form is defined in an HTML document using the < f o r m >  element.  This element has an
               opening and closing tag and every item that you wish to be in the form should be enclosed
               therein.  The < f o r m >  element takes a number of command elements that designates how
               the form is to be processed:
                   Ø a c t i o n = ” u r l ” :  This defines an URL to which the output of the form is directed.
                       This is generally a CGI script or some other program capable of processing the
                       information gathered by the form.  The protocol set for the target URL, along with
                                                     command parameters determine the way in which
                       the e n c t y p e  and m e t h o d
                       gathered information is submitted and processed.  If no action parameter is included,
                       then the URL of the HTML document that includes the form itself, becomes the target
                       of the form.
                                                       f o r m a t " :  Defines the format to be used to transmit
                   Ø e n c t y p e = " d a t a  e n c o d i n g
                       user form responses to the host server if the protocol provided by the action
                       command parameter does not require a specific format.         You will not use this
                       95% of the time.       Generally, this parameter is not necessary if data is MIME
                       encoded, since this is the default for HTML forms.
                   Ø m e t h o d = " . . . " : Defines the method by which the form contents will be transmitted
                       to the host server.  There are two main options:
                              g e t  – This is the default method that appends the values entered by the user
                          o
                              to the URL and is read as a q u e r y s t r i n g .
                              p o s t  - This is the generally preferred method which formats data using MIME
                          o
                              encoding type “a p p l i c a t i o n / x - w w w - f o r m - u r l e n c o d e d ”.  It sends the
                              data as part of the data body rather than appended to the URL.




               LoudOffice.com Guide to HTML – Part II                                               Page 11
   6   7   8   9   10   11   12   13   14   15   16