Use for loop to output HTML table : For : Language Basics PHP Source Code


PHP Source Code » Language Basics » For »

 

Use for loop to output HTML table



 <HTML>
  <HEAD>
  <TITLE>Value of Shares</TITLE>
  <H3>Table Showing Cost of Shares</H3>
  <BODY>
  <TABLE BORDER=1>
  <?php
  for ($shares = 1; $shares <= 20; $shares++){
     $cost = $shares * 20;
     echo "<TR><TD>The cost of $shares share/s is $cost #x0024s</TD>","n";
     $dividend = $cost * 0.10;
     echo "<TD>The dividend is $dividend #x0024s</TD></TR>  " ,"n";
  }
  ?>
  </TABLE>
  </BODY>
  </HTML>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Language Basics
» For