Form Tag in HTML | Important Tags in HTML

Form Tag in HTML

Form tag is a very important tag in HTML. By the form tag, we can design a form in a webpage. A form is used to pass data from a user to the server. If you want to design a form on your website or webpage then you should use form tag. A form can contain your data by text fields, check boxes, radio button, dropdown etc. A most important element in form tag is input element. Input element is the most important element in form tag.

Attributes of Form Tag:

  • Action:- This attribute is used to send form data when a form is submitted.
  • Method:- This attribute specifies that how to send form data. The form data can be sent as URL variables (with method=”get”) or as HTTP post (with method=” post”).

Some Important Elements of Form Tag:

  • <input>
  • <button>
  • <option>
  • <select>
  • <textarea>

Source Code of Form Tag is given below:

NOTE: Here some.php is a php file which will use the data which will pass through a form.

 

<html>

<head>

<title>table example</title>

</head>

<body>

<form action="some.php" method="post">

<table>

<tr>

<td>Name</td>

<td><input type=text /></td>

</tr>

<tr>

<td>Password</td>

<td><input type=password /></td>

</tr>

<tr>

<td>Gender</td>

<td><input type=radio name=gender/>M<input type=radio name=gender/>F</td>

</tr>

<tr>

<td>Course</td>

<td><input type=checkbox name=php/>PHP

<input type=checkbox name=java/>JAVA</td>

</tr>

<tr>

<td>City</td>

<td>

<select>

<option>DELHI</option>

<option>Roorkee</option>

<option>Dehradun</option>

<option>khatima</option>

</select>

</td>

</tr>

<tr>

<td><input type=submit />

<input type=reset /></td></td>

</tr>

</table>

</form>

</body>

</html>

Output of the Form Tag in HTML:

 form tag in html

Leave a Reply

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