लोड हो रहा है...

HTML फ़ॉर्म

रेस्पॉन्सिव ने चौड़ाई ठीक की। फ़ॉर्म नया अध्याय है: विज़िटर टाइप और सबमिट करता है। कंटेनर form है।

फ़ॉर्म क्यों मायने रखते हैं

स्टैटिक पेज दिखाते हैं; फ़ॉर्म इकट्ठा करते हैं। बिना form ब्राउज़र नहीं जानता कौन से कंट्रोल एक सबमिट के हैं।

सीधा उत्तर

1) form with action/method. 2) name वाले कंट्रोल। 3) label for = id। 4) submit बटन। पहले मार्कअप।

📊 Form parts at a glance

Part Job Beginner tip
form Groups controls for one submission Keep related fields inside one form
action URL or path that receives the data Practice paths are fine while learning
method How the browser sends the payload get puts data in the URL; post uses the request body
input (+ others) Collects a value from the user Always set name for submitted keys
label Names the field for people and assistive tech for must match the control id
submit Triggers sending the form Prefer type="submit" on buttons

न्यूनतम फ़ॉर्म कंकाल

कंटेनर और दो attribute से शुरू करें। अभ्यास पथ सीखने के लिए काफ़ी है।

Minimal form skeleton

html
<form action="/subscribe" method="post">
<!-- fields go here -->
</form>

कंकाल पढ़ें

  • form सबमिट सीमा है
  • action प्राप्त पथ
  • post = बॉडी
  • get = URL
  • असली सर्वर के बिना 404 सीखना ठीक

लेबल वाला फ़ील्ड + सबमिट

कम से कम एक फ़ील्ड और भेजने का तरीका। for और id मिलें; name रखें।

Subscribe form with label

html
<form action="/subscribe" method="post">
<label for="email">Email</label>
<input id="email" name="email" type="email" required>
<button type="submit">Subscribe</button>
</form>

सब्सक्राइब डेमो पढ़ें

  • for और id जुड़ते हैं
  • name पेलोड की कुंजी
  • type=email ब्राउज़र संकेत
  • button type=submit भेजता है

GET बनाम POST

get बुकमार्क खोज के लिए; post जब डेटा एड्रेस बार में न रहे।

अभ्यास — छोटा सब्सक्राइब फ़ॉर्म

  1. post वाला form
  2. लेबल वाला email input + name
  3. button type=submit
  4. रेंडर जाँचें
  5. input को थोड़ी देर बाहर रखें

आसान गलतियाँ

  • form के बाहर input
  • name गायब
  • बिना type=submit बटन
  • label/for मेल नहीं
  • action और method उलझाना

सार

  • form एक भेजने के लिए कंट्रोल लपेटता है
  • action + method लक्ष्य और शैली बताते हैं
  • label और name फ़ील्ड भेजने योग्य बनाते हैं
  • अगला: फ़ॉर्म attributes

🧠 अपने ज्ञान की परीक्षा करें

शुरू करने के लिए तैयार

अपने ज्ञान की परीक्षा करें

इस इंटरैक्टिव क्विज़ के साथ अपनी चुनौती लें और देखें कि आप विषय को कितनी अच्छी तरह समझते हैं

❓
5
प्रश्न
🎯
70%
पास करने के लिए
♾️
∞
समय
🔄
∞
प्रयास

📝 निर्देश

  • हर प्रश्न को ध्यान से पढ़ें
  • हर प्रश्न के लिए सबसे अच्छा उत्तर चुनें
  • आप जितनी बार चाहें क्विज़ दोबारा दे सकते हैं
  • आपकी प्रगति शीर्ष पर दिखाई जाएगी