DEV Community

Cover image for FORM IN HTML
Parthipan M
Parthipan M

Posted on

FORM IN HTML

 What is an HTML element used to collect data from the user like login,registration,feedback,etc.

 Commonly used HTML Form tag:
Enter fullscreen mode Exit fullscreen mode
  1. – the container tag that wraps all form elements
  2. – for text, password, email, checkbox, radio, file, submit, etc.

  3. – describes/names an input field

  4. – for multi-line text input</p></li> <li><p><select> – creates a dropdown list</p></li> <li><p><option> – defines each item inside a <select></p></li> <li><p><button> – clickable button (submit, reset, or custom)</p></li> <li><p><fieldset> – groups related form elements together visually</p></li> <li><p><legend> – gives a caption/title to a <fieldset></p></li> </ol> <p># Common form elements:</p> <p>Lable tag:<br> the for attribute must match the id of the input field. </p> <p><label for="student name">name</label></p> <div class="highlight"><pre class="highlight plaintext"><code> Input tag: <input id="student name"placeholder="enter your name" type="text" /> Textarea: used for multiple lines of text input. <textarea type="feedback" id="feedback"></textarea> GET vs POST: GET </code></pre></div> <ul> <li>Data is sent visibly in the URL</li> <li>Used for search, filters, or non-sensitive visible data</li> <li>Limited amount of data can be sent</li> </ul> <p>POST</p> <ul> <li>Data is sent hidden (in the request body)</li> <li>Used for sensitive data like login, registration</li> <li>Can send larger amounts of data</li> </ul>

Top comments (0)