DEV Community

Parthipan M
Parthipan M

Posted on

FORM IN HTML

what is an HTML elements used to collect data from the user (like login,registration,feedfack,etc..,)

Commonly used HTML Form tag:

1.

– the container tag that wraps all form elements.
  1. – for text, password, email, checkbox, radio, file, submit, etc.
  2. – describes/names an input field.
  3. – for multi-line text input .<br> 5.<select> – creates a dropdown list. <br> 6.<option> – defines each item inside a <select><br> 7.<button> – clickable button (submit, reset, or custom)<br> 8.<fieldset> – groups related form elements together visually<br> 9.<legend> – gives a caption/title to a <fieldset></p>

<p>Common form elements:</p>

<p><em>Lable tag:</em><br>
the for attribute must match the id of the input field. <br>
ex: <br>
<label for="student name">name</label></p>

<p>Input tag:<br>
</p>
<div class="highlight"><pre class="highlight html"><code><span class="nt"><input</span> <span class="na">id=</span><span class="s">"student name"</span><span class="na">placeholder=</span><span class="s">"enter your name"</span> <span class="na">type=</span><span class="s">"text"</span> <span class="nt">/></span>

</code></pre></div>
<p></p>
<div class="highlight"><pre class="highlight plaintext"><code> Textarea:
used for multiple lines of text input.
ex:
<textarea type="feedback" id="feedback"></textarea>
</code></pre></div>
<p>GET vs POST:</p>

<p>GET</p>

<ul>
<li>Data is sent visibly in the URL Used for search, filters, or non-sensitive visible data</li>
<li>Limited amount of data can be sent</li>
</ul>
<h2>
<a name="post" href="#post" class="anchor">
</a>
POST
</h2>

<p>Data is sent hidden (in the request body)<br>
Used for sensitive data like login, registration<br>
Can send larger amounts of data</p>

Top comments (0)