- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use tables to structurize forms in HTML?
The tables can be used to create and structurize forms in HTML. But, before that let us see how to create a form in HTML.
Create a Form in HTML
Example
Let us see how to create a form using the <form> tags. We have set three input type radio with individual labels −
<!DOCTYPE html> <html> <head> <title>HTML Form</title> </head> <body> <h1>Details</h1> <form id="myform"> <p>Select the subject you want to choose:</p> <div> <input type="radio" id="prog" name="subject" value="prog"> <label for="prog">Programming</label> <input type="radio" id="dev" name="subject" value="dev"> <label for="dev">Web Development</label> <input type="radio" id="db" name="subject" value="db"> <label for="db">Database</label> </div><br/> <div> <button id="submit" type="submit">Submit</button> </div> </form> </body> </html>
Create a Form using HTML Tables
Now, let us convert the above form to a form created using HTML tables. The <form> is set inside the <table> tag −
<table> <form id="myform"> <!- - --> </form> </table>
Then come the rows, wherein we have set the from input type −
<tr> <td> <input type="radio" id="prog" name="subject" value="prog"> </td> </tr>
Example
The above goes on for every input type i.e. a <tr> for every input. Let us now see the complete example −
<!DOCTYPE html> <html> <head> <title>HTML Form</title> </head> <body> <h1>Details</h1> <p>Select the subject you want to choose:</p> <table> <form id="myform"> <tr> <td> <input type="radio" id="prog" name="subject" value="prog"> </td> <td> <label for="prog">Programming</label> </td> </tr> <tr> <td> <input type="radio" id="dev" name="subject" value="dev"></td> <td> <label for="dev">Web Development</label> </td> </tr> <tr> <td><input type="radio" id="db" name="subject" value="db"></td> <td> <label for="db">Database</label> </td> </tr> <tr> <td><button id="submit" type="submit">Submit</button></td> </tr> </form> </table> </body> </html>
- Related Articles
- How to use the submit button in HTML forms?
- What HTML forms are and how to use them?
- How to create tables in HTML?
- How do we use radio buttons in HTML forms?
- How do we use checkbox buttons in HTML forms?
- How to Parse HTML pages to fetch HTML tables with Python?
- How to save HTML Tables data to CSV in Python
- How to clear all the input in HTML forms?
- How to allow multiple file uploads in HTML forms.
- How to prevent buttons from submitting forms in HTML?
- Why do we use reset button in HTML forms?
- How to take user input using HTML forms?
- How do we use a simple drop-down list of items in HTML forms?
- How to use blockquote in HTML?
- HTML Tables

Advertisements