Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Use for loop to output HTML table

Mon Oct 27, 2008 12:54 pm

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




Post a reply
  Related Posts  to : Use for loop to output HTML table
 echo command to output HTML     -  
 HTML Scrollable table     -  
 adding caption to table in html     -  
 HTML Table Of Contents Generator     -  
 Sort HTML table from JQuery     -  
 OUTPUT??     -  
 what is the output of this program and how it be?     -  
 Input-Output Operations     -  
 output associate array by print_r     -  
 Do while loop     -  

Topic Tags

PHP Loops