Dynamic Generation of Tags from an Array : HTML « HTML « PHP






Dynamic Generation of Tags from an Array

 
<HTML>
<HEAD><TITLE>Using the array as a list</TITLE></HEAD>
<BODY>
<?php
    $images = array('image1.jpg', 'image2.jpg', 'image3.jpg');
    foreach($images as $val): ?>

    <IMG SRC="/images/<?php echo $val; ?>">

<?php endforeach;?>

</BODY>
</HTML>
  
  








Related examples in the same category

1.Display of HTML using PHP code
2.Dynamic HTML tags
3.Dynamic PHP page creation
4.Dynamic date insertion
5.Example: Creating an XHTML document from PHP
6.Output Control
7.Output image tag
8.Output image tag with global path value
9.The Header