Jump to content


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


HELP! Random LINKING image generator

Recommended Posts

I am trying to make a random image generator for my website, mugglenet.com. I have several different images, representing several differents sections of my site. But I want each image, when it appears, to LINK to the relevant section of the site. Here is the coding I came up with so far - would be grateful if someone could set me right!

[code]<? $imagevar=rand(1, 6); if($imagevar==1) { print "<a


src='/layouts/advertisements/book.gif' style="border: 0px" /></a>"; } else

if($imagevar==2) { print "<a href='/editorials/'><img

src='/layouts/advertisements/edit.gif'  style='border: 0px' /></a>"; } else

if($imagevar==3) { print "<a href='/infosection/'><img

src='/layouts/advertisements/ency.gif'  style='border: 0px' /></a>"; } else

if($imagevar==4) { print "<a href='http://fanfiction.mugglenet.com'><img

src='/layouts/advertisements/ff.gif'  style='border: 0px' /></a>"; } else

if($imagevar==5) { print "<a href='/movies/movie5/'><img

src='/layouts/advertisements/film.gif'  style='border: 0px' /></a>"; } else

if($imagevar==6) { print "<a href='/gallery'><img

src='/layouts/advertisements/gallery.gif'  style='border: 0px' /></a>"; ?>[/code]

Share this post

Link to post
Share on other sites
"Switch stament"? I'm really not experience at all in PHP, so if this is a PHP term, I've no idea what it is...

Share this post

Link to post
Share on other sites


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.