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
Moderator: General Moderators
-
phpfreak
- Forum Commoner
- Posts: 30
- Joined: Fri Mar 21, 2003 10:28 am
- Location: New Jersey,USA
- Contact:
random banner php array
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
===============================================
<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