Understanding FORM Tag

While designing the web application that accepts input from the user and then process the information entered by the user you need to design a form in your web application.
In PHP you can design the form which contains various input controls that allows users to input information using the concept of FORM element.
The general syntax of FORM element is given below:
<Form> </Form>
FORM element having starting tag as well as closing tag as shown above. It does not have any formatting attributes.
There are two important attributes of FORM element which are:
(1) Method:
This attribute specifies which method will be used by the FORM element to transfer the contents of the various controls to the specified URL or File. It can have one of the two values: GET or POST
(2) Action:
This attribute specifies the name of the URL or file to which the contents of the various controls are sent for the processing.
Thus the general syntax of FORM element should like this:

<FORM Method=”GET or POST” Action=”URL or FileName”> </FORM>


Understanding INPUT tag

Once you define the Form in your PHP web page your next task is to place various controls that accept input from the user in different ways.
INPUT element allows you to place various controls in the Form to accept input from the user.
The INPUT element must contained in FORM element as shown below:
<FORM Method=”GET” Action=”Second.Php”>
<INPUT Type=”text” Name=”UserName” >
<INPUT Type=”text” Name=”Password” >

There is no need to close the <INPUT> tag.
Following are the important attributes that are used with INPUT element:
(1) Name:
This attribute specifies the name of the Input control.
This name is used when the value of the control is passed to the destination file for processing using GET method.
This name is used to retrieve the value of the input control in the destination file when using the GET or POST method.
(2) Type:
This attribute specifies the type of the Input control.
You can specify different value for this attribute such as:

Type Control Name
1 Text Textbox
2 Hidden Hidden Textbox
3 Password Password textbox
4 Radio Radio Button
5 Checkbox Checkbox
6 Submit Submit Button
7 Select Dropdown List

(3) Value:
This attribute specifies the value associated with the input control.

Download Projects

Download Programs