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

Link to comment
Share on other sites

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....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.