HTML form An HTML form is a part of an HTML document that contains controls such as text fields, password fields, checkboxes, radio buttons, submit buttons, etc.



The <form> Element

Using <form> element we can get user input:

Syntax:

<form>
......
form elements to get the input
...........
</form>


Type Description
<input type="text"> show a single-line text input field
<input type="radio"> show a radio button
<input type="checkbox"> show a checkbox 
<input type="submit"> show a submit button
<input type="button"> show a clickable button

Text Input:

<input type="text">

Ouptut:




Password Input:

<input type="password">

Output:


Radio Input:

 Gender:<br>
        Male:<input type="radio" name="radio" id="gender">
        Female<input type="radio" name="radio" id="gender1">

Output:

Gender:
Male: Female



Checkbox Input:

 Checkbox<br>
        Checkbox2 <input type="checkbox">
        Checkbox2 <input type="checkbox">

Output:

Checkbox
Checkbox2 Checkbox2



Buttons:

<input type="button" value="Button1">
<input type="button" value="Button2">

Output: