[SOLVED] if statement changing value
Posted: Wed Sep 29, 2004 1:22 pm
Hi,
The code below should check the value from a URL variable, and then return a text string determined by what the URL is. This should be simple...
The first echo $targeting returns the correct value. But when it gets toe end the echo $targeting always returns 1.5.
Forgive my stupidity here, I'm a windows programmer, not a php programmer (yet). Why is the if statement changing the value of my $targeting variable??
Thanks,
Josh
The code below should check the value from a URL variable, and then return a text string determined by what the URL is. This should be simple...
Code: Select all
<?php
$targeting = $_POST['targeting'];
$cpmimpressions = $_POST['CPM'];
echo $targeting;
if ($targeting = 1.5)
{
$targetingname = "Non-Targeted Popunders";
}
elseif ($targeting = 2)
{
$targetingname = "Language-Targeted Popunders";
}
elseif ($targeting = 2.5)
{
$targetingname = "Country-Targeted Popunders";
}
elseif ($targeting = 3)
{
$targetingname = "Language and Category-Targeted Popunders";
}
elseif ($targeting = 3.5)
{
$targetingname = "Country and Category-Targeted Popunders";
}
echo $targeting;
?>The first echo $targeting returns the correct value. But when it gets toe end the echo $targeting always returns 1.5.
Forgive my stupidity here, I'm a windows programmer, not a php programmer (yet). Why is the if statement changing the value of my $targeting variable??
Thanks,
Josh