Form Processing

Form Processing

It refers to the operations which occur after the form is submitted by usually clicking the ‘submit’ button. These details are given in the opening <form> tag by the action attribute (which is required), the method and enctype attributes (which are optional). Each is discussed

action Attribute

It specifies the location or program to which the form’s information is sent and it can be in the form of either an e-mail address or the URL of a script or program as shown

<form action=”[email protected]”>

<form action=”login.php “>

The e-mail is not used as there is no official specification and output vary with browsers.

The program transports the form data to the server for processing and is called as Common Gateway Interface (CGI) which is written in different scripting languages like ASP .Net, PHP, or Python.

method Attribute

It is used in the opening <form> tag. It tells web browser how to send the data to the server by using two values which are

get – It takes all the data submitted with the form and sends it to the server attached at the end of the URL like /response.php?name=abhay

This method is used to transfer small amounts of information to the server like text to search. In it form data is encoded by a browser into a URL.

post – It is used to transfer comprehensive data or lots of data. In it the form data is to appear within a message body. This allows for arbitrary length data of any type to be sent to the server.

enctype Attribute

It stands for encoding type which indicates the web browser how to format the data when the method attribute is set to post. Its default value is ‘application/x-wwwform-urlencoded’ which works on most forms. Values for this attribute are

application/x-www-form-urlencoded – It s the default method used by most forms. It converts spaces to the plus sign and non-alphanumeric characters into the hexadecimal code for that character in ASCII text.

mutlipart/form-data – It allows the data to be sent in parts, with each consecutive part corresponding the a form control, in the order they appear in the form. Each part can have an optional content-type header of its own indicating the type of data for that form control.

Get industry recognized certification – Contact us