Jump to content

[SOLVED] change Image on refresh...


phpSensei

Recommended Posts

Im going to take it that you want it to be random ... If you dont say .. Also you would have the chance of the same one coming up more then once but it can be maded to stop that..

 

$randomImages = array("dog", "cat");
$rand = array_rand($randomImages);

echo "<img src='/images/$rand.gif'></img>";

 

Will randomly select dog or cat and display it.. If you dont want it random just make other code to change the $rand variable that declares what image to be displayed..

 

Andy

pocobueno1388: No matter who gets there first.. different methods of coding techniques..are always helpful.

 

phpSensei.. No Prob! Glad to be of some help.

 

Andy

 

 

Ha, both methods are amazing...

 

I needed this for an MMORPG, so when the user refreshes the page, his/her character will be in a different position....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.