PhP Array Activity
PhP Array Activity
Use Multidimensional PHP array
<!DOCTYPE html>
<html>
<head>
<title>Activity</title>
<style type="text/css">
table{
font-family: Arial;
border-collapse: collapse;
width: 100%;
}
td,th{
border: 1px solid gary;
padding: 8px;
}
tr:nth-child(even){
background-color: lightgray;
}
tr:hover{
background-color: gray;
}
th{
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: green;
color: white;
}
</style>
</head>
<body>
<h2>PHP array Activity</h2>
<?php
$company = array(
array('Alfreds Futterkiste','Maria Anders','Country'),
array('Berglunds snabbkop','Christina Berglund','Sweden'),
array('Centro comercial Moctezuma','Francisco chang','Mexico'),
array('Ernst Handel','Roland Mendel','Austria'),
array('Island Trading','Helen Bennett','UK'),
array('Koniglich Essen','Philip Cramer','Germany'),
array('Laughing Bacchus Winecellars','Yoshi Tannamuri','Canada'),
array('Magazzini Alimentari Riuniti','Giovanni Rovelli','Italy'),
);
?>
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<?php for($row = 0; $row< 8; $row++){
?>
<tr>
<?php for($col = 0; $col< 3; $col++){ ?>
<td><?php echo $company[$row][$col]; ?></td>
<?php }?>
</tr>
<?php } ?>
</table>
</body>
</html>
No comments:
Post a Comment