HTML Learning Hub - Complete Beginner Guide


Learn | Revise | Practice

Home Contact documentation Courses


HTML Notes πŸ“˜ – Read & Revision


πŸ“‘ Table of Contents



What is an HTML Form?

HTML form user se input collect karke server ko bhejne ka standard tareeqa hai, jaise login, signup, order, registration, ya search

Server par data key=value pairs ke roop me jata hai, jahan key input ka name hota hai aur value user ka bharaya hua data.

Back To Top

form Tag

element form ka container hai jisme sab form controls (input, label, textarea, select, button) hote hain. Action aur method attributes define karte hain data kahan aur kaise submit hoga

Example
Back To Top

input Tag

single-line input field banata hai aur type attribute ke hisaab se behavior change hota hai (text, number, email, password, date, file, etc.).

Har input ko meaningful name dena zaroori hai taaki backend samajh sake kaunsa field hai.

Example
Back To Top

label Tag

Label par click se linked input focus/checked ho jata hai, jo UX improve karta hai.

Example
Back To Top

Detailed Explanation of Form Structure

Form structure me labels, inputs, grouping, aur naming follow karke aisa layout banta hai jo user-friendly ho aur backend mapping easy ho. Har field ka id UI linking ke liye aur name server mapping ke liye consistently use hota hai

Back To Top

Name & Value Attributes

Submission par har field key=value pair banata hai jahan key input ka name aur value user-entered data hota hai.

Agar name nahi hoga to value server tak meaningful tarah nahi pahunchti

Example
Back To Top

Using name Attribute

name attribute server ko batata hai ki yeh kaunsa column/field fill karna hai, isliye yeh backend ke contract ka hissa hota hai

Ek hi logical group (jaise gender) me sab radio buttons ka name same hota hai taaki ek hi key ki sahi value jaye.

Back To Top

Radio Buttons

Radio buttons single-choice inputs hote hain; ek group me sirf ek select hota hai aur sabka name same hota hai.

Value attribute se β€œon” ki jagah meaningful value (male/female/other) bhejte hain

Example
Back To Top

for Attribute

label ka for attribute us input ki id se match hota hai jisse label par click karne se input active/checked ho jata hai

Yeh accessibility aur click-target dono improve karta hai.

Example
Back To Top

Setting Radio Button Values

Radio/checkbox par value set na ho to submit par β€œon” jata hai, isliye value="male" ya value="python" jaisi clear values deni chahiye.

Isse server par direct meaningful data store ho pata hai bina guesswork ke

Back To Top

Checkboxes

Checkboxes multi-select ke liye hote hain; ek se zyada options tick ho sakte hain aur har selected checkbox apni value submit karta hai.

Same name use karke server ko list of values milti hai (e.g., subject=Python aur subject=JavaScript)

Example
Back To Top

Placeholder Attribute

placeholder input box ke andar light hint text dikhata hai jo user type karte hi gayab ho jata hai.

Yeh data submit nahi hota, sirf guidance ke liye hota hai.

Example
Back To Top

Types of Input Attributes

input type="date"

type="date" date picker deta hai jisse YYYY-MM-DD format me date aati hai aur min/max se range limit ki ja sakti hai

Example

input type="file"

type="file" user ko file choose karne deta hai; files bhejne ke liye form me enctype="multipart/form-data" use karna padta hai

Example

input type="email"

type="email" basic email format validation deta hai aur mobile par relevant keyboard lata hai.

Example

input type="tel"

type="tel" telephone number input ke liye hai; by default strict validation nahi hoti, isliye pattern se format enforce kiya ja sakta hai

Example
Back To Top

textarea Tag

multi-line text input deta hai comments/address jaise lambi entries ke liye.[11] rows/cols ya CSS se size control hota hai.
textarea name="address" rows="4" cols="30" placeholder="Full address"

Back To Top

select Tag

select> ek HTML form element hai jo dropdown menu banata hai. Iske andar options dikhane ke liye option> tag ka use hota hai.

Back To Top

option Tag

option> ek selectable item define karta hai; value attribute server ko bheji jane wali exact value set karta hai. User-facing text aur submitted value alag ho sakte hain for clarity. option value="IN">India

Back To Top

Button Tag

button ek HTML tag hai jo ek clickable button banata hai.

Back To Top


Go to Home
Go to Page 1
Go to Page 2
Go To page 3
Go to Page 5
Go to Page 6