4.4.1. Form Elements
You can include form elements like text-box, text-area, radio button, check box, password box and buttons in your web page using the form elements. The important part of a form element is the concept of the name/value pairs. When the information is sent to the server, it is sent two parts: first an identifier, or name, and then the actual data. For example, in a text box with a name like Firstname where the user has typed John, the data will be sent to the server as Firstname = John.
Form elements can be created using the <INPUT> tag. For example to create a text box you have to do the following:
To create a text box:
- Inside the FORM area of your HTML document type the <INPUT TYPE = “text”
- Give the text box a name by adding NAME= “name”. When the data is sent to the server, the information entered into this text box will be identified by the name.
- If desired define the size of the box using SIZE = “n”, (default value of n is 20 characters).
- Finish the definition of the text box by typing>
Example 4.4 –HTML forms (with a text box, password, radio button and a button)
<HTML> <HEAD> <TITLE> Banking Page – form demo </TITLE> </HEAD> <BODY text = black> <FORM method = “get” action = “demoone.html”> <T> <B> <H2> Deutsche Bank </H2></B> </I> <LABEL> <H2> A/C NO. </H2> </LABEL> <INPUT type =password name =”acno”> <BR> <LABEL> <H2> PIN </H2> </LABEL> <INPUT type = password name =”pin”> <BR> <LABEL> <H2> BALANCE ENQUIRY </H2> >/LABEL> <INPUT type = radio name =”enq”> <BR> <LABEL> <H2> TRANSACTION STATEMENT </H2> /LABEL> <INPUT type = radio name =”statement”> <BR> <INPUT type = BUTTON value = submit> <BR> </FORM> </BODY> </HTML>
You can use table to align your form elements.
Users can enter upto 32,700 characters in a text area.
All data is sent to the server when user clicks an active image like a button. So give specific instructions to use the active image.