1

Same code is displayed DIFFERENT over XHTML () and HTML5 ()

<table border="1">
<tr><th>COL1</th><th>COL2</th><th>COL3</th></tr>
<tr><form action="">
<td>111</td><td><input type="text" name="correo" /></td><td>333</td>
</form></tr>
and other TR with other form ...
and other TR with other form ...
and other TR with other form ...
...
</table>

... I need display this with XHTML, but all distortion...

With HTML: enter image description here

With xHTML: this is result using xHTML

how I can fixed this?

VyR
  • 151
  • 1
  • 2
  • 9
  • Does this answer your question? [Form inside a table](https://stackoverflow.com/questions/5967564/form-inside-a-table) – Quentin Apr 05 '20 at 19:56

1 Answers1

0

The styling can be achieved in HTML5's XML syntax (aka XHTML) by using

<style>
    tr form { display: contents; }
    td { border: 1px inset black; }
</style>

but don't. Your mark-up is not valid HTML5 in either the HTML syntax or the XML syntax.

Instead you should use the form attribute on the controls to associate the control with a form, like this:

<form action="" id="myform1"></form>
<table border="1">
  <tr><th>COL1</th><th>COL2</th><th>COL3</th></tr>
  <tr>
    <td>111</td>
    <td><input type="text" name="correo" form="myform1" /></td>
    <td>333</td>
  </tr>
</table>
Alohci
  • 70,004
  • 12
  • 103
  • 143
  • Dear Alohci I need one button [SUBMIT] by each ROW and I cant't use the traditional var1[], var2[]... AS arrays in PHP.By this I need make a independent form in each ROW. is possible over xHTML ? – VyR Apr 06 '20 at 20:29
  • 1
    I can't comment about PHP, but surely you just need an independent form *per* each row, not *in* each row. You could put the form in, say. the first td of each row, but it doesn't change the solution.You still need the form attribute to connect each control to the id of its form, and each id needs to be unique,of course. – Alohci Apr 06 '20 at 22:45