Well, since nobody seems to want to answer your question, I will... :)
It has to do with you using an assignment '=' instead of a comparison '==' operator in your condition.
Follow along with my inline notes below.
Gary wrote:
I am trying to get this to work, however it only reads the second if
statement. I get no error messages, but as I change counties, the % stays
the same.
Can someone enlighten me, or should I be looking at switch statements?
Thanks for your help.
Gary
<?php
$_SESSION['sale_session']=$_POST['sale'];
$_SESSION['assess_session']=$_POST['assess'];
$_SESSION['county_session']=$_POST['county'];
// checks if bot
if ($_POST['address'] != '' ){
exit("Changed field");
}
$sale_value=$_POST['sale'];
$assess_value=$_POST['assess'];
$county=$_POST['county'];
$chester_ratio=.51;
$montco_ratio=.53;
$delco_ratio=.58;
/*$ratio=.51;
/*$correct_assess=($sale_value)*($ratio); this is now the assessment should
be */
$chester_correct_assess=($sale_value)*($chester_ratio);
$montco_correct_assess=($sale_value)*($montco_ratio);
$delco_correct_assess=($sale_value)*($delco_ratio);
$chester_assess_difference=($assess_value)-($chester_correct_assess);
$montco_assess_difference=($assess_value)-($montco_correct_assess);
$delco_assess_difference=($assess_value)-($delco_correct_assess);
/* $assess_difference=($assess_value)-($sale_value * $ratio);
$percent_difference=($assess_difference)/($assess_value);*/
$chester_percent_difference=($chester_assess_difference)/($assess_value);
$delco_percent_difference=($delco_assess_difference)/($assess_value);
$montco_percent_difference=($montco_assess_difference)/($assess_value);
$chester_percent_savings=($chester_percent_difference)*100;
$delco_percent_savings=($delco_percent_difference)*100;
$montco_percent_savings=($montco_percent_difference)*100;
if(($_COOKIE['county_cookie'] ='Chester') && ($chester_assess_difference
>=50000))
The previous line should be, notice the missing == comparison ???
if(($_COOKIE['county_cookie'] == 'Chester') && ($chester_assess_difference >= 50000))
{
echo '<h2 style="margin:0;color:#ff0000;">Yes, Your property appears to
qualify!</h2><br /><br />';
echo "You 1 believe your home would today sell for <b>
$".number_format($sale_value)." </b><br />";
echo "Your current tax assessment is<b>
$".number_format($assess_value)."</b><br />";
echo "You live in <b>$county </b><br />";
echo "Your potential savings could be<b> "
.number_format($chester_percent_savings,0)."%</b><br /><br />";
echo "According to preliminary calculations based on the information you
have entered, you may enjoy a savings of <b>
".number_format($chester_percent_savings,0)."% </b>off a combined total of
county, school and township real estate taxes. Actual dollar amount savings
will differ depending on the township that the property is located. Please
contact my office for a more precise estimate of savings.<br />";
}
elseif(($_COOKIE['county_cookie']='Delaware') && ($delco_assess_difference
>=30000)) {
Same thing here
echo '<h2 style="margin:0;color:#ff0000;">Yes, Your property appears to
qualify!</h2><br /><br />';
echo "You 2 believe your home would today sell for <b>
$".number_format($sale_value)." </b><br />";
echo "Your current tax assessment is<b>
$".number_format($assess_value)."</b><br />";
echo "You live in <b>$county </b><br />";
echo "Your potential savings could be<b> "
.number_format($delco_percent_savings,0)."%</b><br /><br />";
echo "According to preliminary calculations based on the information you
have entered, you may enjoy a savings of <b>
".number_format($delco_percent_savings,0)."% </b>off a combined total of
county, school and township real estate taxes. Actual dollar amount savings
will differ depending on the township that the property is located. Please
contact my office for a more precise estimate of savings.<br />";
}
elseif(($_COOKIE['county_cookie']='Montgomery') &&
($montco_assess_difference >=50000))
Same thing here
{
echo '<h2 style="margin:0;color:#ff0000;">Yes, Your property appears to
qualify!</h2><br /><br />';
echo "You 3 believe your home would today sell for <b>
$".number_format($sale_value)." </b><br />";
echo "Your current tax assessment is<b>
$".number_format($assess_value)."</b><br />";
echo "You live in <b>$county </b><br />";
echo "Your potential savings could be<b> "
.number_format($montco_percent_savings,0)."%</b><br /><br />";
echo "According to preliminary calculations based on the information you
have entered, you may enjoy a savings of <b>
".number_format($montco_percent_savings,0)."% </b>off a combined total of
county, school and township real estate taxes. Actual dollar amount savings
will differ depending on the township that the property is located. Please
contact my office for a more precise estimate of savings.<br />";
}
else if(($chester_assess_difference <=50000) &&
($chester_assess_difference>=1000)) {
echo '<h3 style="margin:0;">While it appears you may enjoy some savings, the
dollar amount may not reach the threshold required for action. If property
values in your area continue to decline, you may wish to revisit this issue
again next year.</h3><br /><br />';
}
else if(($delco_assess_difference <=30000) &&
($delco_assess_difference>=1000)) {
echo '<h3 style="margin:0;">While it appears you may enjoy some savings, the
dollar amount may not reach the threshold required for action. If property
values in your area continue to decline, you may wish to revisit this issue
again next year.</h3><br /><br />';
}
else if(($montco_assess_difference <=50000) &&
($montco_assess_difference>=1000)) {
echo '<h3 style="margin:0;">While it appears you may enjoy some savings, the
dollar amount may not reach the threshold required for action. If property
values in your area continue to decline, you may wish to revisit this issue
again next year.</h3><br /><br />';
}
else if(isset($chester_assess_difference) <=1000){
echo '<h3 style="margin:0;">NO, Your property does not appear to qualify. If
property values in your area continue to decline, you may wish to revisit
this issue again next year. </h3><br /><br />';
}
else if(isset($delco_assess_difference) <=1000){
echo '<h3 style="margin:0;">NO, Your property does not appear to qualify. If
property values in your area continue to decline, you may wish to revisit
this issue again next year. </h3><br /><br />';
}
else if(isset($montco_assess_difference) <=1000){
echo '<h3 style="margin:0;">NO, Your property does not appear to qualify. If
property values in your area continue to decline, you may wish to revisit
this issue again next year. </h3><br /><br />';
}
/*This is just a test to see which one is being displayed*/
echo "chester $chester_ratio .''. $chester_correct_assess .''.
$chester_percent_savings<br/>";
echo "montco $montco_ratio.''. $montco_correct_assess .''.
$montco_percent_savings<br />";
echo "delco $delco_ratio .''. $delco_correct_assess.''.
$delco_percent_savings";
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php