HTML Forms aur Input Controls - Detailed Guide
HTML forms web pages par user se data collect karne ka sabse important tareeka hain. Forms me kai tarah ke input controls use hote hain jinhe samajhna jaruri hai.
Form Tag
<form>
tag HTML me ek form ko define karta hai. Isme action aur method attributes important hain:
action
: Form data bhejne wali URL ya file specify karta hai.method
: Data bhejne ka tareeka batata hai, jaiseGET
yaPOST
.
<form action="submit.php" method="post">
</form>
Common Input Types aur Controls
Forms me input fields kai tarah ke hote hain, jinhe user ki zarurat ke hisaab se use kiya jata hai:
- Text Box:
<input type="text">
, single line text ke liye. - Password:
<input type="password">
, confidential text ke liye jise chhupaya jata hai. - Email:
<input type="email">
, email validation ke sath. - Number:
<input type="number">
, sirf numbers ke liye. - Textarea:
<textarea>
, multiline text ke liye. - Radio Buttons:
<input type="radio">
, options me se ek select karne ke liye. - Checkboxes:
<input type="checkbox">
, multiple options select karne ke liye. - Dropdown List:
<select>
aur<option>
for select box. - Buttons: Submit, Reset, aur normal buttons ke liye
<input type="submit">
,<input type="reset">
, aur<button>
.
Labels ka Importance
<label>
tag har input field ko describe karta hai, jo accessibility ke liye bahut zaruri hai. Label ko input se link karne ke liye for
attribute use hota hai jo input ke id
se match kare.