I’m having some difficulty writing this code in php. I want to create a random image not for background which I learn from my previous thread but I want to learn how to create a random image. Here is what I got so far I only did the array and the html but my php code is incomplete:
//Random Image PHP
$images = array(array("image 1" => "caption 1"),
array("image 2" => "caption 2"),
array("image 3" => "caption 3");
//HTML
<div class="image-with-caption">
<img src="image 1/<?php echo $file; ?>.jpg" />
<p id="caption"><?php echo $caption; ?></p>
</div>
I appreciate any explanation & examples.
1 Answer