4.4. Getting User Input with HTML forms

One of the most powerful parts of the web page is the form.  Forms let you collect information from the user.  When browsing web sites, users often need to provide such information as search key words, e-mail addresses and zip codes.  You can use HTML forms, for collecting such data from user.

Data that users enter in a web page normally is sent to a web server that provides access to site on the same machine as the web server or on a machine that the web server can access through the network.  When a browser requests web page or file that is located on a server, the server processes the request and returns the requested resource.

In HTML a form is designed with <form> tag and </form> tag.  The form tag has two important attributes.  They are

  • Action
  • Method

The Action attribute

The forms are used to get the input from the user.   The user input is submitted to the server. N The action attribute informs the browser the location of the server program to which the form input has to be submitted.  The server program may be a cgi-peri script, a java applet or any other server program like JSP, ASP etc.

The Method Attribute

The method attribute has only two choices of values.  They are

Method =”get”

Method = “post”

The method “post” appends form data to the browser request, which contains the protocol and the requested resource URI.  The other possible value, “get” method appends the form data directly to the end of the URL.


<form method = post action =”………….xyz.jsp”>

Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

− three = 5

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter