Jeeva Jeeva - 5 months ago 20
HTML Question

How can i create table row and column vertically

I wanted the following table to be diaplayed vertically.

<table id="news" class="table table-striped table-responsive">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>City</th>
</tr>
</thead>
<tbody>
<?php
for($i=0; $i<5; $i++)
{ ?>
<tr>
<td>
<input type="text"/>
</td>
<td>
<input type="email"/>
</td>
<td>
<input type="number"/>
</td>
<td>
<input type="text"/>
</td>
</tr>

<?php
}
?>
</tbody>
</table>


The Table will be displayed in below format
enter image description here

I want that to be displayed like the below format.

Row0 Name [input]
Row0 Email [input]
Row0 Phone [input]
Row0 City [input]

Row1 Name [input]
Row1 Email [input]
Row1 Phone [input]
Row1 City [input]

.
.

Row4 Name [input]
Row4 Email [input]
Row4 Phone [input]
Row4 City [input]


I want the html table to displayed like the above. Your help is highly appreciated. Thanks in advance.

Answer Source

Is this what you want,

<table id="news" class="table table-striped table-responsive">
    <tbody>
        <?php
        for($i=0; $i<5; $i++) 
        { ?>
        <tr>
        <td><b>row0</b></td>
           <th>Name</th>
            <td>
              <input type="text"/>
            </td>
          </tr>
          <tr>
          <td><b>row0</b></td>
            <th>Email</th>
             <td>
               <input type="email"/>
            </td>
          </tr>
          <tr>
          <td><b>row0</b></td>
            <th>Phone</th>
            <td>
               <input type="number"/>
            </td>            
          </tr>
          <tr>
          <td><b>row0</b></td>
            <th>City</th>
            <td>
               <input type="number"/>
            </td>            
          </tr>
        <?php
        }
        ?>           
    </tbody>
</table>

You just need to think out of the box a bit