Page 189 - Webapplication11_C11_Flipbook
P. 189

Creating Forms
                 The syntax for creating a form in HTML is:

                 <FORM NAME = "Name of the form" ACTION = "Script URL" METHOD = "GET/POST">

                 ...(Input Elements)
                 </FORM>
                 Ð ÐACTION: This attribute specifies what action should be taken once the SUBMIT button is clicked by the user. The
                   Script URL specifies the location where the data collected by the form is submitted. It also produces a response in
                   return.
                  ÐMETHOD: This attribute specifies what will happen when the form is submitted. Two values can be assigned to the
                 Ð
                   METHOD attribute, Get and Post.
                       Get: It is the default  value for the method attribute. The form data is sent as the URL variable, i.e., it appends
                      the form data into the URL. Get value should not be used for sensitive information.

                       Post: The form data is sent as an HTTP post transaction and form data is not appended to the URL. This value is
                      used for submitting sensitive information.

                 Input Controls

                 Input controls are the elements that are used to accept input from the site visitors. All the controls have to be filled in
                 before submitting the form. Now, learn the various types of input controls.
                 Text Input Controls

                 There are three types of text input controls used on forms:
                 Single-line text input control
                 This control is used to enter single-line inputs. It is used as a search box or name. The two attributes associated
                 with single-line text input controls are: SIZE and MAXLENGTH. The SIZE attribute defines the size of the text box and
                 MAXLENGTH defines the number of characters the textbox can hold.

                 Syntax of  single-line text input control:
                 <INPUT TYPE = "TEXT" NAME = "The word that describes the textbox" SIZE = "The width
                 you want to use for the text box" MAXLENGTH = "Maximum number of characters">
                 Write HTML codes for creating a single-line text input control:

                 <!DOCTYPE html>
                 <HTML>
                 <HEAD>
                 <TITLE> Single Line Text Input Control </TITLE>
                 </HEAD>

                 <BODY>
                 <FORM NAME = "Registration From" METHOD = "POST" ACTION = "mailto:niidhiarora@
                 gmail.com">
                 <Hl ALIGN = "CENTER"> Registration </Hl>
                 <B>ApplicantName:</B>
                 <INPUT TYPE = "TEXT" NAME = "APPLI_NAME" SIZE = "30" MAXLENGTH = "20">
                 <BR> <BR>

                 <B>Address: </B>
                 <INPUT TYPE = "TEXT" NAME = "ADDRESS" SIZE = "30" MAXLENGTH = "40">
                                                                                Website Building Using HTML and CSS  187
   184   185   186   187   188   189   190   191   192   193   194