HTML Form Tutorial for Beginners Study Material Notes with Examples
Forms not only provide communication from user to server, but also provide powerful stuff and can add a lot of value to the web pages.
Forms are used to get inputs from the user. The user input is submitted to the server. A form is defined with <form>……</form> tag.
Form tag has three attributes as follows
This attribute specifies where to send the form-data when a form is submitted or what action needs to be performed when form is submitted.
e.g., If we want a program “\cgi\bin\comments.exe” to be executed, when a form is submitted , then we write
action = “/cgi/bin/comments.exe”
This attribute defines how the data will be submitted to the server to go to the next page. Two methods are there, get and post. In get method, the data of the form is appended in the URL of next page.
e.g., <form method = “get/post” action = “a. exe” >
This is used to inform the server the way to handle the encryption process. encrypt = “application/x-www. form-urlencoded”
Elements of a Form
The elements of a form can be of three types
- Input box
- Selection list box or combo box
- Text area
Selection Box (Combo Box) The <select • tag is used to create a select list (drop down list).
The option> tag inside the select element define the available options in the list.
<option value = “volvo” > volvo < /option> <option value = “scoda” > scoda < /option>
<option value = “Mercedes” > mercedes </option</select>
Text Area Multiline area in which user can type the text as input. It has three attributes as number of rows, number of columns in text area and the name of the variable.
<center> Enter your text
<text area Name = “Remarks” rows = 5 column = 50>
Frames allow us to divide a browser window into several independent Parts. It is a way of displaying two or more pages at once.
Frames could be applied for the following on the web page as given below
- To display the log or a stationary information in one fixed portion of the
- For the table of contents in a page, where people can just click and move around the website without having to more constantly to the contents
Example for Cols
< frameset cols = 200, 400> size is in pixel
cols specify the number of vertical windows or frames and values in them specify the width of the frame in frameset. We can provide values either in pixel or in percentage. For percentage we need to mention values with % sign, For pixel, we should not give any sign with the value as in above example.
Example for Rows
Row specifies number of horizontal windows or frames and values in rows specify the height of the frame
< frameset rows = 100, 40%, *›
Frame window will have three frames, where the height of the first frame is of 100 pixels, the second is 40% of the main window and the height of the 3rd one will occupy the rest of the window space.
<frameset rows = “50%”, “50%”>
<frame set col s = “50%”, “50%”>
<frame src = A. html>
<frame src = B. html> </frameset>
<frame cols = “50%”, “50%”>
<frame src = C. htmi >
<f rame src = D.htmt>
Sorting in Design and Analysis of Algorithm Study Notes with Example
Learn Sorting in Handbook Series: Click here