help

Associate
Joined
14 Oct 2006
Posts
761
i have 4 different advertisements for my site that link to other forums and gaming sites

how would i make these so everytime the page is refreshed the image changes aswell as the link they go to

now each image has to goto a specific link aswell as a specific image to go with the link

how would i go about doing this :confused:
 
You don't specify any language requirements, so I'll assume you can use PHP. Following is quick and simple, and modifying it should be self-evident.
Code:
<?php
$links[] = array('image' => 'whatever1.jpg', 'link' => 'http://wherever1');
$links[] = array('image' => 'whatever2.jpg', 'link' => 'http://wherever2');
$links[] = array('image' => 'whatever3.jpg', 'link' => 'http://wherever3');
$links[] = array('image' => 'whatever4.jpg', 'link' => 'http://wherever4');
shuffle($links);

printf('<a href="%s"><img src="%s" alt="" /></a>', $links[0]['link'], $links[0]['image']);
 
Back
Top Bottom