Hi... I am kind of new to PHP, but I am familar enough to poke around in it.
Here is my issue.
I am making a simple banner rotation app.
When I use two different "includes" in the body area, the data from Include01 loads into Include02 sometimes, but not all the time.
Why is my data from 01 loading into 02 includes in my html page?
HTML CODE..
<body>
ZONE 1<br>
<?php require "zone01.php"; ?>
<p></p>
ZONE 2<br>
<?php require "zone02.php"; ?>
</body>
ZONE01.PHP
<?php
## ENTER LINKS HERE
$Ad01[0] = '<a href="http://www.technipixel.com"><img src="banners/fupc_flier.jpg" border="0" /></a>';
$Ad01[1] = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="300" height="100"><param name="movie" value="banners/test.swf" /><param name="quality" value="high" /><embed src="banners/test.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="100"></embed></object>';
## ENTER WEIGHTS HERE
$Weight[0]=1;
$Weight[1]=2;
## CHOOSE AD
$sum =0;
for($i=0;$i<count($Weight);$i++)
$sum+=$Weight[$i];
$ShowAd = rand(0, $sum - 1);
for($i=0;$i<count($Weight);$i++)
{
if($ShowAd<=$Weight[$i])
{
$ShowAd=$i;
break;
}
else
$ShowAd-=$Weight[$i];
}
echo $Ad01[$ShowAd];
?>
ZONE02.PHP
<?php
## ENTER LINKS HERE
$Ad02[0] = '<a href="http://www.technipixel.com"><img src="banners/createexe.jpg" border="0" /></a>';
$Ad02[1] = '<a href="http://www.technipixel.com"><img src="banners/website_gleasonmedia.jpg" border="0" /></a>';
$Ad02[2] = '<a href="http://www.technipixel.com"><img src="banners/fupc_flier.jpg" border="0" /></a>';
## ENTER WEIGHTS HERE
$Weight[0]=1;
$Weight[1]=2;
$Weight[2]=2;
## CHOOSE AD
$sum =0;
for($i=0;$i<count($Weight);$i++)
$sum+=$Weight[$i];
$ShowAd = rand(0, $sum - 1);
for($i=0;$i<count($Weight);$i++)
{
if($ShowAd<=$Weight[$i])
{
$ShowAd=$i;
break;
}
else
$ShowAd-=$Weight[$i];
}
echo $Ad02[$ShowAd];
?>
Thanks
🙂