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
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>

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.