0% found this document useful (0 votes)
6 views

Forms and Input

Uploaded by

baskar p
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Forms and Input

Uploaded by

baskar p
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

Creating Forms
• The <form> tag is used to create a form in
HTML.
• Attributes:
o action: Specifies the URL where the form
data will be sent after submission.

o method: Defines the HTTP method to


send the form data. Common values are:
▪ GET: Appends form data to the URL
in name/value pairs.
▪ POST: Sends form data inside the
body of the HTTP request.

2. Form Elements
• <input>: Used to create various types of form
fields.
o Text Input:

o Password Input:

o Email Input:

o Number Input:

o Radio Button:

o Checkbox:
o Submit Button:

• <textarea>: Used for multi-line text input.

• <select>: Creates a dropdown list.


o <option>: Defines options within the
<select>.

• <button>: Used to create a clickable button.

3. Form Validation
• HTML provides basic form validation using
attributes:
o required: Ensures that the field is filled
out.

o pattern: Specifies a regular expression


that the input must match.

o min and max: Define the minimum and


maximum values for number inputs.

o maxlength: Limits the number of


characters that can be entered in a text
field.
These notes should help you understand
the basic concepts of forms and inputs in
HTML!

You might also like