hi im having trouble in my codes..anybody please help me in my code i always get the last condition in my if statement..i always get the Mercedes Benz even i choose already another type of car here is the code
i know it is a messy code but please help me guyz.
Code:
<?php
$zone;
$vehicle;
if($zone=="Manila" && $vehicle="Toyota VIOS 1.3 MT")
{
$perday=3000;
$permonth=9000;
$perhour=125;
$car=1000;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota VIOS 1.3 AT")
{
$perday=3000;
$permonth=9000;
$perhour=125;
$car=3000;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota VIOS 1.5 MT")
{
$perday=3000;
$permonth=9000;
$perhour=125;
$car=3500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota VIOS 1.5 AT")
{
$perday=3600;
$permonth=9000;
$perhour=150;
$car=3500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota ALTIS 1.5 AT")
{
$perday=3600;
$permonth=9000;
$perhour=150;
$car=3500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota ALTIS 1.5 MT")
{
$perday=3600;
$permonth=9000;
$perhour=150;
$car=3500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota Innova MT")
{
$perday=4000;
$permonth=9000;
$perhour=167;
$car=4500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota Grandia MT")
{
$perday=4000;
$permonth=9000;
$perhour=167;
$car=4500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota Camry AT")
{
$perday=5200;
$permonth=9000;
$perhour=217;
$car=12000;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Toyota Grandia MT")
{
$perday=4000;
$permonth=9000;
$perhour=167;
$car=4500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Nissan Urvan MT")
{
$perday=4000;
$permonth=9000;
$perhour=167;
$car=4500;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" && $vehicle="Nissan Cefiro AT" )
{
$perday=5200;
$permonth=9000;
$perhour=217;
$car=12000;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
if($zone=="Manila" &&$vehicle="Mercedez Benz AT")
{
$perday=6400;
$permonth=9000;
$perhour=267;
$car=30000;
$rhr;
$phr;
$total;
$totalhr;
$rday;
$pday;
$totald;
$totalday;
$rmonth;
$pmonth;
$totalm;
$totalmonth;
if($rhr>$phr)
{
$total=($rhr)- ($phr);
$totalhr=$perhour * $total;
}
else if($rhr==$phr)
{
$totalhr;
}
if($rday>$pday)
{
$totald=($rday)-($pday);
$totalday=$perday * $totald;
}
else if($rday==$pday)
{
$totalday;
}
if($rmonth>$pmonth)
{
$totalm=$rmonth-$pmonth;
$totalmonth=$totalm * $permonth;
}
else if($rmonth==$pmonth)
{
$totalmonth;
}
$rate=$car+$totalhr+$totalday;
}
?>
Rate:₱<?php echo number_format("$rate,2"); ?> </p>
i know it is a messy code but please help me guyz.
Comment