php - Tables in Tabbed Panes -


i have this.

<div id="tabs">     <ul>         <li><a href="#tabs-1">tab 1</a></li>         <li><a href="#tabs-2">tab 2</a></li>         <li><a href="#tabs-3">tab 3</a></li>     </ul>     <div id="tabs-1">         <p>tab 1 content</p>     </div>     <div id="tabs-2">         <p>tab 2 content</p>     </div>     <div id="tabs-3">         <p>tab 3 content</p>     </div> </div> 

instead of content (tab 1 content...) in each of tabs, need tables. structure of tables in 3 tabs same, content changes mysql query. query results may have thousands of rows.

how can go it? new javascript , php thanks

what trying achieve basically:

<div id="tabs">     <ul>         <li><a href="#tabs-1">tab 1</a></li>         <li><a href="#tabs-2">tab 2</a></li>         <li><a href="#tabs-3">tab 3</a></li>     </ul>     <div id="tabs-1">         <table> <!-- rest of table1 --> </table>     </div>     <div id="tabs-2">         <table> <!-- rest of table2 --> </table>     </div>     <div id="tabs-3">         <table> <!-- rest of table3 --> </table>     </div> </div> 

you can use php code create these tables (i assume have queried db , have data in variable $rows ):

<div id="tabs-1">   <table>   <?php foreach ($rows $data)        {          echo "<tr>";         echo "<td>". $data['attribute1'] . "</td><td>". $data['attribute2'] . "</td>"";          echo "</tr>";       }    ?>   </table> </div> 

well, above code not complete though, can add table header, decorate css etc per requirement. using method, have repeat code each table. since said have same table structure in 3 tabs, can create div tags in loop self. in case have:

for(loop many tabs want) {     echo "<div id='tabs-'".index.">";      /* query db , data $rows variable */      foreach ($rows $data) {              echo "<tr>";             echo "<td>". $data['attribute1'] . "</td><td>". $data['attribute2'] . "</td>"";              echo "</tr>";           }       echo "</div>"; } 

again, need decorate per requirements. these code snippets should started!


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -