Jump to content

Dynamic row number of table


phpgoal

Recommended Posts

Hello,

 

I have a html table with 10 rows but I do not need 10 rows always. I want to see a number of rows depending on a value. That means during run time, if generated value is 2, i want to see only two rows. If generated value is 3, i want to see only three rows.

 

How can i do that?

 

-P

Link to comment
https://forums.phpfreaks.com/topic/279527-dynamic-row-number-of-table/
Share on other sites

Hello,

 

I have the below code. Depending on the value of row, i want to see the same number of rows in the table. Can i do it?

 

<script>Var row = 5</script>

 

<table width='400' cellpadding='5' cellspacing='5' border='5'    row = '5'>

<tr> <td><b>Month/Year</b> </td> <td> <b>Income</b></td> <td><b>Expense</b> </td> <td><b>MK</b> </td> <td><b>MS</b> </td></tr>

<tr> <td>
<p id="m0">Hello World!</p> </td> <td> <p id="i0">Hello World!</p></td> <td><p id="e0">Hello World!</p></td> <td><p id="k0">Hello World!</p> </td> <td><p id="s0">Hello World!</p> </td></tr>

</table>

  On 6/24/2013 at 9:23 PM, phpgoal said:

Can i do it?

 

What part of the example I provided did you not understand? Put the code to create a row inside that loop. Put anything you need to display before those rows (e.g. the opening table tabs and headers) before the loop. And, put anything you need after those rows (e.g. the closing table tag) after the loop.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.