Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using <input> tags directly inside <table>

Tags:

html

php

xhtml

I'm generating a table with multiple editable rows. like a employee every row so that you can change multiple names at the same time. I have some hidden fields inside that also need to be looped with the table rows.

The problem is that having inputs inside table tags is not valid xhtml. And I don't want to wrap them inside <tr><td> tags since this would clearly make a new column for hidden fields that don't need one.

Does someone know if I can wrap them inside something else to make it valid xhtml?

like image 942
RJD22 Avatar asked Jan 26 '10 13:01

RJD22


2 Answers

You can put the hidden <input>s in an existing cell.

like image 91
SLaks Avatar answered Sep 22 '22 05:09

SLaks


They're hidden, you can place them next to any visible input and be fine.

<tr>
  <td><input type="text" name="fname" /></td>
  <td><input type="text" name="lname" />
      <input type="hidden" name="cid" value="11" />
      <input type="hidden" name="uid" value="12" />
  </td>
</tr>
like image 31
Sampson Avatar answered Sep 22 '22 05:09

Sampson