HTML Form

The HTML Form is used to collect input from user, For example used registration form for collect information like name,email,phone etc.

Form elements in HTML are text fields, textarea , checkboxes,radio buttons, drop-down etc.
<form> tag is used to create a form in HTML

Syntex

<form action=”PageURL” method=”GET|POST”>
form elements
</form>

Some <input> Element in HTML

examples:

Text Input
<input type=”text”> Used to defines text box input field

Example

<form>
Name:<br>
<input type="text" name="name"><br>
Address:<br>
<input type="text" name="address">
</form>

CheckBox Input
<input type=”checkbox”> Used to defines a checkbox

Example

<form>
<input type="checkbox" name="subject[]" value="one" >First<br>
<input type="checkbox" name="subject[]" value="two"> Second<br>
</form>

Radio Button Input
<input type=”radio”> Used to defines a radio button

Example

<form>
<input type="radio" name="category" value="GEN" checked>General<br>
<input type="radio" name="category" value="SC"> SC<br>
<input type="radio" name="category" value="OBC"> OBC
</form>

The Submit Button
<input type=”submit”> Used to defines a submit button

Example

<form action="/action_page.php">
Nname:<br>
<input type="text" name="name" value="Amit"><br>
<input type="submit" value="Submit">
</form>

Leave a Reply

Your email address will not be published. Required fields are marked *