Form

HTML Form

1. Text Fields

Text fields are used when you want the user to type letters, numbers, etc. in a form.

Example

<html>
<Head>
<tittle>Form Tag </tittle>
</Head>
<body>
<form>
First name:
<input type="text" name="firstname">
Last name:
<input type="text" name="lastname">
</form>
</body>
</html>

Output:-

First name:
Last name:

2. Radio Buttons

Radio Buttons are used when you want the user to select one of a limited number of choices.

Example

<html>
<Head>
<tittle>Form Tag </tittle>
</Head>
<body>

<form>
<input type="radio" name="sex" value="male"> Male
<br>
<input type="radio" name="sex" value="female> Female
</form>
</body>
</html>

Output:-

Male
Female

Note:that only one option can be chosen.

3. Checkboxes

Checkboxes are used when you want the user to select one or more options of a limited number of choices.

Example

<html>
<Head>
<tittle>Form Tag </tittle>
</Head>
<body>

<form>
<input type="checkbox" name="bike">
I have a bike
<br>
<input type="checkbox" name="car">
I have a car
</form>

</body>
</html>

Output:-

I have a bike
I have a car