Posts: 253
Location: Calgary, Alberta, Canada
|
Hey there fellow Digital Notion'er
I have used a code like this before on one of my websites, which displayed one of multiple images for the header. Hopefully I'm remembering this correctly
PHP Code:
<?php
$imagevar=rand(1, 3); // First number is minimum amount of things to be chosen from, the second is the max. I had 3 headers, so I had a max of 3. if($imagevar==1) { echo "<img src='img/header.gif'>"; } else if($imagevar==2) { echo "<img src='img/header2.gif'>"; } else if($imagevar==3) { echo "<img src='img/header3.gif'>"; } ?>
The script is pretty self explanatory, and there may be a more practicle way of doing it, but this way should work as well. Also, the variable $imagevar can be anything you want.
Hope this helps (and works  )!
__________________
Signature Coming Soon! :) Please login or register to view this content. Registration is FREE
|