Forum Moderators: coopster
<? If $adloader = "1";
require("ad1.php");
Else
require("ad2.php");
?>
Thanks for your help.
W.
Take a look at php.net for how ifs work, but hers a starter for you:
<?
if($adloader === "1"){
include("ad1.php");
}else{
include("ad2.php");
}
?>
Somethings to look at - the conditional test uses === rather than =. A single = assigns rather than compares (leading to big trouble in if tests). You can use == or === but the third tests if something is identically equal, ie same value and same data type. Note how this could impact your test, you have "1", using quotes says the data is a string value rather than numeric, so depending on your script the === could give you issues.
$adloader is defined as 1, or not defined at all;
If you will turn up error reporting to E_ALL, you'll see that this throws a warning if you use Robber's code.
If possible, have it so $adloader is always defined as in
$adloader = (condition which if true, we load ad)? 1 : 0;
Then in your code
if ($adloader) { do stuff }
If you can't do that, you should test
if (isset($adloader) && $adloader == 1) { do stuff }
This will avoid any PHP warnings
Tom