form tag in html
HTML Form
Forms are used in HTML for getting inputs from the user. An HTML form contains different types of input elements like text field, label, field set, checkbox, list box, and radio-button; submit button and more that allow user to enter information. When data entry is complete the user submit the form by clicking the submit button on the page. On submit, the data send to server for processing. The processing is done through CGI Scripts - PHP, ASP, Java Script, VB script or etc. This CGI scripts resides at the server side. After fills up the form and click the submit button the data passes either through method POST (used to pass large amount of data) or GET (used to pass small amount of data, passed along with the URL) to the server side script that then handles data and perform appropriate action. The Syntax of the form tag is:
<FORM>………</FORM>
Form Elements
The most important form element is the <input> element. The <input> element is used to select user information. An <input> element can vary in many ways, depending on the type attribute. An <input> element can be of type text field, checkbox, password, radio button, submit button, and more. In the following section, we explore the most common input types one by one.
Text Field
To add single line text entry fields for text input (first name, last name and so on) use the <input> element with the type=”text” attribute.
Example:
<input type="text"> defines a single-line input field that a user can enter text into:
<HTML>
<HEAD>
<TITLE> Simple Input Box </TITLE>
</HEAD>
<BODY>
<FORM>
<B>First Name: </B> <input type="text" name="firstname"><BR><BR>
<B>Last Name: </B> <input type="text" name="lastname">
</FORM>
</BODY>
</HTML>
Save the file and open it in a browser.
The form itself is not visible. Also note that the default width of a text field is 20 characters.
To set a text field that allows maximum 10 characters to be entered, use the following:
<input type="text" name="firstname" maxtength="10">
<input type="password"> Defines a password field:
<HTML>
<HEAD>
<TITLE> Simple Input Box Password </TITLE>
</HEAD>
<BODY>
<FORM>
<B>First Name: </B> <input type="text" name="firstname"><BR><BR>
<B>Last Name: </B> <input type="text" name="lastname"><BR><BR>
<B>Password: </B> <input type="password" name="pwd">
</FORM>
</BODY>
</HTML>
0 মন্তব্য(গুলি):
একটি মন্তব্য পোস্ট করুন
Comment below if you have any questions