Page 1 of 1

Random Banner

Posted: Sat Apr 19, 2003 6:41 am
by mzfp2
How can i load a random html file into a IFRAME element to simulate a random banner, which loads a different banner everytime page is loaded?

http://www.alljammin.com

random banner php array

Posted: Mon Apr 21, 2003 1:14 pm
by phpfreak
check this out. there can be any number of banners, then the page loads any of the website(banners) depending on the random number choosen by the random function.
===============================================

<html>
<head>
<title>iframes test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
$banner_array=array();
$banner_array[0]="http://www.hotmail.com";
$banner_array[1]="http://www.cnn.com";
$banner_array[2]="http://www.yahoo.com";
$banner_array[3]="http://www.timesofindia.com";
$banner_array[4]="http://www.microsoft.com";
$banner_array[5]="http://www.devnetwork.net/forums";
?>
<body>
<iframe height="200" width="800" name="banner" src="<?php $i=rand(0,5); echo "$banner_array[$i]";?>">
hi there
</iframe>
</body>
</html>
===============================================
i hope this helps.Let me know if you want something else

regards
srinivas