Monday, December 21, 2009

change picture each time web page loads

Image can change on web page, you showing different christmas pictures when web page loads on a users computer. I want them to see a different picture each time in php page.





echo '<img src="$filename" >';


1 comment:

  1. Why not remove the first part of your code and do something like this:

    <img src="file<?=rand(1,8)?>.gif" />


    echo '<img src="file'.rand(1,8).'.gif" />';

    Saves you 11 lines of code and you dont instantiate three unnecessary variables.