Register now or log in to join your professional community.
within form tag we define table tag to structure the form
To position form-related elements relative to each other, the entire table must be within the form. You cannot start a form in one TH or TD element and end in another. You cannot place the form within the table without placing it inside a TH or TD element.
try this
Small forms are sometimes placed within a TD element within a table. This can be a useful for positioning a form relative to other content, but it doesn't help position the form-related elements relative to each other. To position form-related elements relative to each other, the entire table must be within the form. You cannot start a form in one TH or TD element and end in another. You cannot place the form within the table without placing it inside a TH or TD element. You can put the table inside the form, and then use the table to position the INPUT, TEXTAREA, SELECT, and other form-related elements, as shown in the following example. <FORM ACTION="[URL]"> <TABLE BORDER="0"> <TR> <TH>Account:</TH> <TD><INPUT TYPE="text" NAME="account"></TD> </TR> <TR> <TH>Password:</TH> <TD><INPUT TYPE="password" NAME="password"></TD> </TR> <TR> <TD> </TD> <TD><INPUT TYPE="submit" NAME="Log On"></TD> </TR> </TABLE></FORM>
WITH IN FORM TAG WE DEFINE TABLE TAG TO STRUCTURE THE FORM
Creating an HTML form is an important aspect when creating a website. Forms are a method of interacting with the users of the website. Thus it becomes necessary that the forms must be properly aligned and attractive when implemented on a website. The process of simply adding an HTML form to a webpage is as follows.
Example:
HTML <!DOCTYPE html> <html> <body> <h2>Welcome To GFG</h2> <p>Default code has been loaded into the Editor.</p> <form> <label for="name">Name</label> <input type="text" id="name" /> <label for="email">Email</label> <input type="email" id="email" /> <label for="telnum">Tel No.</label> <input type="telnum" id="telnum" /> <label for="Roll No.">Roll No.</label> <input type="number" id="rollno" /> </form> </body> </html>
Tables can be used to structure forms. First you have to start and close form tag " <form></form>" then write the name of the field you want to have in form page like Name, Age etc. This will be written within label tag <label for="name">Name</label>. Then the writing space can be created using input tag. It is a single tag.<input type="text" id="name" />
1.Create an HTML table using the <table> element.
2.Now add the <form> element within this table.
3.Next, we will create form fields.
4.We add the required form fields to the form using the <tr> element that is used to add rows to a table.
5.We use the <td> element to add labels and fields for separate columns.
6.We can add as many fields as required to our form.