954,598 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Form Inside Table Getting Messed Up

Hello I'm building a form inside a table but the output is not what I expected; the table should have looked like this:

pic.jpg

Here is my code:

<html>
<head>
<title></title>
</head>
<body>
  <form name="frm_details" method="post" action="mailto:someone@hotmail.com"> 
     <table border="1">
      <tr>
        <td>Name</td>
        <td><input type="text" name="name" size="30"></td>
        <td>ID</td>
        <td><input type="text" name="Id" size="25></td>
      </tr>
      <tr>
        <td>Password</td>
        <td><input type="text" name="password" size="30"></td>
        <td>Address</td>
        <td><textarea cols="30" rows="2" name="address"></td>
      </tr>
        <td>Sex</td>
        <td><input type="radio" name="sex" value="male"/>Male
            <input type="radio" name="sex" value="female"/>Female 
        </td>
      </tr>
    </table>
    </form>
</body>
</html>


I wrote just a part of the code and it is messed up;I have no idea why it is messing up the rows and columns!Like for example why it is not displaying the td(with password text in another row).Can someone help me please?

Attachments pic.jpg 53.48KB
DARK_BYTE
Junior Poster in Training
50 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 
  • Tags which do not have pair close tags should have back slash on the end of their declaration, which all of yours input tags are missing
  • Input for ID is missing double quote after size declaration
<html>
<head>
<title></title>
</head>
<body>
  <form name="frm_details" method="post" action="mailto:someone@hotmail.com"> 
     <table border="1">
      <tr>
        <td>Name</td>
        <td><input type="text" name="name" size="30" /></td>
        <td>ID</td>
        <td><input type="text" name="Id" size="25"/></td>
      </tr>
      <tr>
        <td>Password</td>
        <td><input type="text" name="password" size="30"/></td>
        <td>Address</td>
        <td><textarea cols="30" rows="2" name="address"/></td>
      </tr>
        <td>Sex</td>
        <td><input type="radio" name="sex" value="male"/>Male
            <input type="radio" name="sex" value="female"/>Female 
        </td>
      </tr>
    </table>
    </form>
</body>
</html>
peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

Well here is more of the code but the form inside the table is still not like I want

<html>
<head>
<title></title>
</head>
<body>
  <form name="frm_details" method="post" action="mailto:someone@hotmail.com"> 
     <table border="1" width = "100%">
      <tr>
        <td>Name</td>
        <td><input type="text" name="name" size="30"/></td>
        <td>ID</td>
        <td><input type="text" name="Id" size="25/></td>
      </tr>
      <tr>
        <td>Password</td>
        <td><input type="text" name="password" size="30"/></td>
        <td>Address</td>
        <td><textarea cols="30" rows="2" name="address"/></textarea></td>
      </tr>
        <td>Sex</td>
        <td><input type="radio" name="sex" value="male"/>Male
            <input type="radio" name="sex" value="female"/>Female 
        </td>
        <td>Marital Status</td>
        <td><select name="marital status" size="1">
            <option value="Single">Single</option>
            <option value="Married">Married</option>
            <option value="Divorced">Divorced</option>
            </select>
        </td>      
     </tr>
     <tr>
       <td>Phone</td>
       <td></td>
       <td>email</td>
       <td><input type="text" name="email" size="30"</td>
     </tr>
    </table>
    </form>
</body>
</html>

Here is what I get with this code: Untitled.jpg


The password field which should have been on the second row is not even showing up and the Address field also is messed up.Anyone ever put a form inside a table or a table inside a form?

Attachments Untitled.jpg 69.52KB
DARK_BYTE
Junior Poster in Training
50 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

You are not paying attention to your tags formatting, if they have all double quotes as need it, if the tag is correctly closed and if they are in right order

<html>
<head>
<title></title>
</head>
<body>
  <form name="frm_details" method="post" action="mailto:someone@hotmail.com"> 
     <table border="1" width = "100%">
      <tr>
        <td>Name</td>
        <td><input type="text" name="name" size="30"/></td>
        <td>ID</td>
        <td><input type="text" name="Id" size="25"/></td>
      </tr>
      <tr>
        <td>Password</td>
        <td><input type="text" name="password" size="30"/></td>
        <td>Address</td>
        <td><textarea cols="30" rows="2" name="address"/></textarea></td>
      </tr>
        <td>Sex</td>
        <td><input type="radio" name="sex" value="male"/>Male
            <input type="radio" name="sex" value="female"/>Female 
        </td>
        <td>Marital Status</td>
        <td><select name="marital status" size="1">
            <option value="Single">Single</option>
            <option value="Married">Married</option>
            <option value="Divorced">Divorced</option>
            </select>
        </td>      
     </tr>
     <tr>
       <td>Phone</td>
       <td></td>
       <td>email</td>
       <td><input type="text" name="email" size="30"/></td>
     </tr>
    </table>
    </form>
</body>
</html>
peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

Yep very true thanks a lot!I will try to make an effort to make sure that my tags are correct in the future; thanks!:P

DARK_BYTE
Junior Poster in Training
50 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You