Page 38 - PortGPT_V2.1_C8_Flipbook
P. 38

HTML provides two main tags which are <FORM> and <INPUT> to handle the forms on the web page.
                  Let us learn about these in detail.


                       The <FORM> Tag

                  The <FORM> tag is used to create the form boundary on the web page. It is a container tag. All the
                  other form related tags such as <INPUT>, <SELECT> and <TEXTAREA> are used inside the opening
                  <FORM> and closing </FORM> tags. The syntax to use the <FORM> tag is as follows:


                    <FORM NAME = "Name of the form” ACTION = "Script URL" METHOD = "GET/
                  POST">
                  ...(Form Elements)

                  </FORM>
                   The <FORM> tag has the two main attributes which are:

                  •  ACTION: This attribute is used to specify the action that will take place when we submit

                      the form values. It takes the URL of another web page or an e-mail address to receive the
                      information.

                  •  METHOD: It specifies the type of method form will use to accept the values entered into
                      form fields. The most commonly used values for this attribute are POST and GET.
                       The <INPUT> Tag

                  The <INPUT> tag is one of the most important form elements. It is used to create the controls or
                  fields to take the input from the user in the form of text, selection and click. The <INPUT> tag has the
                  following attributes:

                  •  TYPE: This attribute is used to specify the type of field we want to create. It takes one of the
                      predefined values. The predefined values for this attribute are:

                        TEXT: This value is used to create a text box field. A text box field is a one line text input
                          control. The text is the default value of the TYPE attribute.

                        RADIO: This value is used to create a radio button control. A radio button control is used
                          to select only one option from a set of options.
                        CHECKBOX: This value is used to create a check box control. A check box control allows

                          us to select multiple options from a set of options.
                        BUTTON: This value is used to create a action button control. An action button control
                          is used to perform an action on the click of it.

                        SUBMIT: This value is used to create a submit button control. The submit button control
                          is used to submit all the entered values in form to the specified URL.

                        RESET: This value is used to create a reset button control. The reset button control, when
                          clicked, clears all the values entered in the form fields.




                  36    Premium Edition-VIII
   33   34   35   36   37   38   39   40   41   42   43