Home  >  Article  >  Web Front-end  >  How can we group data in HTML form?

How can we group data in HTML form?

PHPz
PHPzforward
2023-09-09 19:29:011607browse

How can we group data in HTML form?

We use the

tag to group related data in the HTML form. This tag creates a box around the relevant element on the web page. The tag is used within the
tag to provide a title for the group or to provide a name for the group.

How can we group data in HTML form?

grammar

<fieldse>…..</fieldset>

Example 1

The following is an example of using the tag to group data in an HTML form within a

tag -
<!DOCTYPE html>
<html>
<head>
   <meta charset="UTF-8">
   <meta name="description" content="meta tag in the web document">
   <meta name="keywords" content="HTML,CSS">
   <meta name="author" content="lokesh">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
   <form>
      <fieldset>
         <legend>Employee Details</legend>
         Employee Name<br>
         <input type="text" name="Ename">
         <br>
         Employee ID<br>
         <input type="text" name="Eid">
         <br>
         Employee Address<br>
         <input type="text" name="Eid">
         <br>
      </fieldset>
   </form>
</body>
</html>

Example 2

You can try running the following code to group data in an HTML form -

<!DOCTYPE html>
<html>
<body>
   <form>
      <fieldset>
         <legend>Student Information:</legend>
         Student Name:<br>
         <input type="text" name="sname">
         <br>
         Student Subject:<br>
         <input type="text" name="ssubject">
         <br>
      </fieldset>
   </form>
</body>
</html>

The above is the detailed content of How can we group data in HTML form?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete