Output a HTML table : HTML Table « HTML « PHP






Output a HTML table

 
<html> 
<head> 
<title>Table Example</title> 
</head> 
<body> 
<table> 
<?php 
    $Cars = array ("Ford","Dodge","Chevy"); 
    $CarId = array ("K","J","F"); 
    for($x=0; $x < count($Cars); $x++){ 
        print "<tr><td>$CarId[$x]</td>"; 
        print "<td>$Cars[$x]</td></tr>\n"; 
    } 
?> 
</table> 
</body> 
</html>
  
  








Related examples in the same category

1.Creating an HTML table from array elements
2.Use for each to loop through an array and create a table
3.Separate the city and state name in the array so we can total by state