random image display
in a folder I have 5 images named:
add1.jpg, add2.jpg, add3.jpg, add4.jpg, add5.jpg
now I want to display random image when user click refresh or new visitor come to that page.
I have written this code
<?php
$add="add";
$add .= rand(1,5);
$add .=".jpg";
echo "<img border='0' src='$add' width='450' height='50'>";
?>
but i seen that this code always shows one image only
Please tell me how I can do it.
__________________
Best Regard:
Md. Zakir Hossain (Raju)
www.rajuru.xenexbd.com - my blog with PHP scripts, PHP Book Review and many more
|