0% found this document useful (0 votes)
13 views3 pages

HTML Forms

HTML forms allow users to input data using elements like text fields, radio buttons, and checkboxes. Form data can be submitted using GET or POST methods, with GET displaying values in the URL and POST hiding them. Textareas allow multiple lines of input while text fields are single line.

Uploaded by

rcsup91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

HTML Forms

HTML forms allow users to input data using elements like text fields, radio buttons, and checkboxes. Form data can be submitted using GET or POST methods, with GET displaying values in the URL and POST hiding them. Textareas allow multiple lines of input while text fields are single line.

Uploaded by

rcsup91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

HTML Forms :

 An HTML form is used to gather input from the user.


 <form> tag is used for creating an HTML form which can allow users to input
data. <form> tag can contain different types of different elements, like text
fields, radio buttons, checkboxes, submit buttons, etc.
 Type attribute of <input> defines the various ways in which <input> elements can
be shown.
 Various attribute values for the “Type” attribute are mentioned below :

1. <input type="text">

It creates an input field supporting single-line text.

2. <input type="radio">

Creates a radio button (can select only one choice with radio button)

3. <input type="checkbox">

Creates a checkbox (can select zero or multiple choices)

4. <input type="submit">

Creates a submit button (for submitting data in form)

5. <input type="button">

Creates a button

Name attribute :

 Name of an HTML element is defined by the name attribute.

Placeholder attribute :

 This attribute gives a hint to the user, stating the value to be expected from the
user for an input field. (expected input format).
 Hint is shown in the input field before value is entered by the user.
 Example:
Code:

<form>

<input type="text" placeholder="First Name"

<br>

<input type="text" placeholder="Last Name">

</form>

The <textarea> Element :

 It is used to create a field which can contain multiple lines.


 Example:

<textarea name="anyName">

Creates a textarea with 30 rows and 20 columns

</textarea>

Difference between input type=”text” and textarea :

 Textarea can contain multiple lines in it, whereas input type=”text” is used to
contain only one single line.
The method Attribute

 It describes how to send data through form.


 Data collected through form can be sent using GET or POST method.

GET method :

 After a form is submitted using the GET method, its values are visible in the
address bar of the new tab of the browser.
 It should be used for sending data which is not secured, and not for information
that is sensitive.
 Syntax :
<form method=”GET”>

POST method :

 After a form is submitted using the POST method, its values are not visible in the
address bar of the new tab of the browser.
 Syntax :
<form method=”POST”>

You might also like