Save as: link.php
Code:
<?
$links= array(
'http://yahoo.com',
'http://google.com',
'http://www.ebay.com'
);
$random = rand(0,count($links)-1);
?>
include in the page conatining the link. "this makes it less hassle to include in multiple pages"
Code:
include ('link.php');
call the url from a link:
Code:
<a href='<?echo $links[$random];?>'>some name</a>
or
call it from a button:
Code:
<FORM METHOD="LINK" ACTION="<?echo $links[$random];?>">
<INPUT TYPE="submit" VALUE="Go to link">
</FORM>
modified version of my banner rotation script
